340 int i, j, c, len, offset, n_lengths, ngeoms, nrings;
342 Data__Geometry *geometry;
344 int64_t *coords = NULL;
346 geometry =
galloc(DATA__GEOMETRY__TYPE__MULTIPOLYGON);
350 if (ngeoms == 0)
return geometry;
353 for (i = 0; i < ngeoms; i++) {
356 for (j = 0; j < nrings; j++)
360 lengths = palloc (
sizeof (
uint32_t) * n_lengths);
364 lengths[c++] = ngeoms;
365 for (i = 0; i < ngeoms; i++) {
367 lengths[c++] = nrings;
368 for (j = 0; j < nrings; j++) {
378 geometry->n_lengths = n_lengths;
379 geometry->lengths = lengths;
382 geometry->n_coords = offset;
383 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)