PostGIS  2.1.10dev-r@@SVN_REVISION@@
Datum RASTER_makeEmpty ( PG_FUNCTION_ARGS  )

Definition at line 1507 of file rt_pg.c.

References rt_raster_serialized_t::height, POSTGIS_RT_DEBUGF, rtrowdump::raster, rt_raster_destroy(), rt_raster_new(), rt_raster_serialize(), rt_raster_set_offsets(), rt_raster_set_scale(), rt_raster_set_skews(), rt_raster_set_srid(), rt_raster_serialized_t::size, rt_raster_serialized_t::srid, SRID_UNKNOWN, and rt_raster_serialized_t::width.

1508 {
1509  uint16 width = 0, height = 0;
1510  double ipx = 0, ipy = 0, scalex = 0, scaley = 0, skewx = 0, skewy = 0;
1511  int32_t srid = SRID_UNKNOWN;
1512  rt_pgraster *pgraster = NULL;
1513  rt_raster raster;
1514 
1515  if (PG_NARGS() < 9) {
1516  elog(ERROR, "RASTER_makeEmpty: ST_MakeEmptyRaster requires 9 args");
1517  PG_RETURN_NULL();
1518  }
1519 
1520  if (!PG_ARGISNULL(0))
1521  width = PG_GETARG_UINT16(0);
1522 
1523  if (!PG_ARGISNULL(1))
1524  height = PG_GETARG_UINT16(1);
1525 
1526  if (!PG_ARGISNULL(2))
1527  ipx = PG_GETARG_FLOAT8(2);
1528 
1529  if (!PG_ARGISNULL(3))
1530  ipy = PG_GETARG_FLOAT8(3);
1531 
1532  if (!PG_ARGISNULL(4))
1533  scalex = PG_GETARG_FLOAT8(4);
1534 
1535  if (!PG_ARGISNULL(5))
1536  scaley = PG_GETARG_FLOAT8(5);
1537 
1538  if (!PG_ARGISNULL(6))
1539  skewx = PG_GETARG_FLOAT8(6);
1540 
1541  if (!PG_ARGISNULL(7))
1542  skewy = PG_GETARG_FLOAT8(7);
1543 
1544  if (!PG_ARGISNULL(8))
1545  srid = PG_GETARG_INT32(8);
1546 
1547  POSTGIS_RT_DEBUGF(4, "%dx%d, ip:%g,%g, scale:%g,%g, skew:%g,%g srid:%d",
1548  width, height, ipx, ipy, scalex, scaley,
1549  skewx, skewy, srid);
1550 
1551  raster = rt_raster_new(width, height);
1552  if (raster == NULL)
1553  PG_RETURN_NULL(); /* error was supposedly printed already */
1554 
1555  rt_raster_set_scale(raster, scalex, scaley);
1556  rt_raster_set_offsets(raster, ipx, ipy);
1557  rt_raster_set_skews(raster, skewx, skewy);
1558  rt_raster_set_srid(raster, srid);
1559 
1560  pgraster = rt_raster_serialize(raster);
1561  rt_raster_destroy(raster);
1562  if (!pgraster)
1563  PG_RETURN_NULL();
1564 
1565  SET_VARSIZE(pgraster, pgraster->size);
1566  PG_RETURN_POINTER(pgraster);
1567 }
void * rt_raster_serialize(rt_raster raster)
Return this raster in serialized form.
Definition: rt_api.c:8158
void rt_raster_destroy(rt_raster raster)
Release memory associated to a raster.
Definition: rt_api.c:5387
tuple raster
Be careful!! Zeros function's input parameter can be a (height x width) array, not (width x height): ...
Definition: rtrowdump.py:123
void rt_raster_set_srid(rt_raster raster, int32_t srid)
Set raster's SRID.
Definition: rt_api.c:5668
void rt_raster_set_skews(rt_raster raster, double skewX, double skewY)
Set skews about the X and Y axis.
Definition: rt_api.c:5473
void rt_raster_set_scale(rt_raster raster, double scaleX, double scaleY)
Set scale in projection units.
Definition: rt_api.c:5442
#define SRID_UNKNOWN
Unknown SRID value.
Definition: liblwgeom.h:154
Struct definitions.
Definition: rt_api.h:2175
#define POSTGIS_RT_DEBUGF(level, msg,...)
Definition: rt_pg.h:62
rt_raster rt_raster_new(uint32_t width, uint32_t height)
Construct a raster with given dimensions.
Definition: rt_api.c:5353
void rt_raster_set_offsets(rt_raster raster, double x, double y)
Set insertion points in projection units.
Definition: rt_api.c:5504

Here is the call graph for this function: