85 for (uint32_t i = 0; i < pa->
npoints; i++)
97 if (!
opts->srs)
return;
107 if (!
opts->bbox)
return;
161 for (i = 0; i < poly->
nrings; i++)
209 const char tmpl[] =
"{\"type\":\"LineString\",";
238 uint32_t i, ngeoms = mpoint->
ngeoms;
247 for (i=0; i < ngeoms; i++)
263 uint32_t i, ngeoms = mline->
ngeoms;
272 for (i=0; i < ngeoms; i++)
285 uint32_t i, ngeoms = mpoly->
ngeoms;
295 for (i=0; i < ngeoms; i++)
310 uint32_t i, ngeoms = col->
ngeoms;
326 for (i=0; i<ngeoms; i++)
364 if (
opts->isCollectionElement) {
365 lwerror(
"GeoJson: geometry not supported.");
380 GBOX static_bbox = {0};
394 opts.bbox = &static_bbox;
int lwgeom_calculate_gbox_cartesian(const LWGEOM *lwgeom, GBOX *gbox)
Calculate the 2-4D bounding box of a geometry.
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
#define FLAGS_GET_Z(flags)
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
#define LW_TRUE
Return types for functions with status returns.
int lwtriangle_is_empty(const LWTRIANGLE *triangle)
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
static const POINT2D * getPoint2d_cp(const POINTARRAY *pa, uint32_t n)
Returns a POINT2D pointer into the POINTARRAY serialized_ptlist, suitable for reading from.
static const POINT3D * getPoint3d_cp(const POINTARRAY *pa, uint32_t n)
Returns a POINT3D pointer into the POINTARRAY serialized_ptlist, suitable for reading from.
static int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members)
static void pointArray_to_geojson(stringbuffer_t *sb, const POINTARRAY *pa, const geojson_opts *opts)
static void asgeojson_point(stringbuffer_t *sb, const LWPOINT *point, const geojson_opts *opts)
Point Geometry.
static void asgeojson_srs(stringbuffer_t *sb, const geojson_opts *opts)
static void asgeojson_triangle(stringbuffer_t *sb, const LWTRIANGLE *tri, const geojson_opts *opts)
Triangle Geometry.
static void asgeojson_multipoint(stringbuffer_t *sb, const LWMPOINT *mpoint, const geojson_opts *opts)
Multipoint Geometry.
static void asgeojson_geometry(stringbuffer_t *sb, const LWGEOM *geom, const geojson_opts *opts)
static void asgeojson_bbox(stringbuffer_t *sb, const geojson_opts *opts)
static void asgeojson_line(stringbuffer_t *sb, const LWLINE *line, const geojson_opts *opts)
Line Geometry.
static void asgeojson_point_coords(stringbuffer_t *sb, const LWPOINT *point, const geojson_opts *opts, int tagged)
Point Geometry.
static void coordinate_to_geojson(stringbuffer_t *sb, const POINTARRAY *pa, uint32_t i, const geojson_opts *opts)
static void asgeojson_poly(stringbuffer_t *sb, const LWPOLY *poly, const geojson_opts *opts)
Polygon Geometry.
lwvarlena_t * lwgeom_to_geojson(const LWGEOM *geom, const char *srs, int precision, int has_bbox)
Takes a GEOMETRY and returns a GeoJson representation.
static void asgeojson_multipolygon(stringbuffer_t *sb, const LWMPOLY *mpoly, const geojson_opts *opts)
static void asgeojson_collection(stringbuffer_t *sb, const LWCOLLECTION *col, const geojson_opts *opts)
Collection Geometry.
static void asgeojson_poly_coords(stringbuffer_t *sb, const LWPOLY *poly, const geojson_opts *opts, int tagged)
static void asgeojson_multiline(stringbuffer_t *sb, const LWMLINE *mline, const geojson_opts *opts)
Multipoint Geometry.
static void asgeojson_line_coords(stringbuffer_t *sb, const LWLINE *line, const geojson_opts *opts, int tagged)
struct geojson_opts geojson_opts
int stringbuffer_aprintf(stringbuffer_t *s, const char *fmt,...)
Appends a formatted string to the current string buffer, using the format and argument list provided.
lwvarlena_t * stringbuffer_getvarlena(stringbuffer_t *s)
void stringbuffer_init_varlena(stringbuffer_t *s)
static void stringbuffer_append_double(stringbuffer_t *s, double d, int precision)
static void stringbuffer_append_char(stringbuffer_t *s, char c)
static void stringbuffer_append_len(stringbuffer_t *s, const char *a, size_t alen)
Append the specified string to the stringbuffer_t using known length.