PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ encode_collection()

static Data__Geometry* encode_collection ( struct geobuf_agg_context ctx,
LWCOLLECTION lwcollection 
)
static

Definition at line 388 of file geobuf.c.

References encode_geometry(), galloc(), LWCOLLECTION::geoms, and LWCOLLECTION::ngeoms.

Referenced by encode_geometry().

390 {
391  int i, ngeoms;
392  Data__Geometry *geometry, **geometries;
393 
394  geometry = galloc(DATA__GEOMETRY__TYPE__GEOMETRYCOLLECTION);
395 
396  ngeoms = lwcollection->ngeoms;
397 
398  if (ngeoms == 0)
399  return geometry;
400 
401  geometries = palloc (sizeof (Data__Geometry *) * ngeoms);
402  for (i = 0; i < ngeoms; i++) {
403  LWGEOM *lwgeom = lwcollection->geoms[i];
404  Data__Geometry *geom = encode_geometry(ctx, lwgeom);
405  geometries[i] = geom;
406  }
407 
408  geometry->n_geometries = ngeoms;
409  geometry->geometries = geometries;
410 
411  return geometry;
412 }
static Data__Geometry * encode_geometry(struct geobuf_agg_context *ctx, LWGEOM *lwgeom)
Definition: geobuf.c:414
static Data__Geometry * galloc(Data__Geometry__Type type)
Definition: geobuf.c:36
LWGEOM ** geoms
Definition: liblwgeom.h:509
Here is the call graph for this function:
Here is the caller graph for this function: