350 int i, j, c, len, offset, n_lengths, ngeoms, nrings;
352 Data__Geometry *geometry;
354 int64_t *coords = NULL;
356 geometry =
galloc(DATA__GEOMETRY__TYPE__MULTIPOLYGON);
360 if (ngeoms == 0)
return geometry;
363 for (i = 0; i < ngeoms; i++) {
366 for (j = 0; j < nrings; j++)
370 lengths = palloc (
sizeof (uint32_t) * n_lengths);
374 lengths[c++] = ngeoms;
375 for (i = 0; i < ngeoms; i++) {
377 lengths[c++] = nrings;
378 for (j = 0; j < nrings; j++) {
388 geometry->n_lengths = n_lengths;
389 geometry->lengths = lengths;
392 geometry->n_coords = offset;
393 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)