351 int i, j, c, len, offset, n_lengths, ngeoms, nrings;
353 Data__Geometry *geometry;
355 int64_t *coords = NULL;
357 geometry =
galloc(DATA__GEOMETRY__TYPE__MULTIPOLYGON);
361 if (ngeoms == 0)
return geometry;
364 for (i = 0; i < ngeoms; i++) {
367 for (j = 0; j < nrings; j++)
371 lengths = palloc (
sizeof (uint32_t) * n_lengths);
375 lengths[c++] = ngeoms;
376 for (i = 0; i < ngeoms; i++) {
378 lengths[c++] = nrings;
379 for (j = 0; j < nrings; j++) {
389 geometry->n_lengths = n_lengths;
390 geometry->lengths = lengths;
393 geometry->n_coords = offset;
394 geometry->coords = coords;
static Data__Geometry * galloc(Data__Geometry__Type type)
static int64_t * encode_coords(struct geobuf_agg_context *ctx, POINTARRAY *pa, int64_t *coords, int len, int offset)