PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ coordinate_to_geojson()

static void coordinate_to_geojson ( stringbuffer_t sb,
const POINTARRAY pa,
uint32_t  i,
const geojson_opts opts 
)
static

Definition at line 51 of file lwout_geojson.c.

52{
53 if (!FLAGS_GET_Z(pa->flags))
54 {
55 const POINT2D *pt = getPoint2d_cp(pa, i);
57 stringbuffer_append_double(sb, pt->x, opts->precision);
59 stringbuffer_append_double(sb, pt->y, opts->precision);
61 }
62 else
63 {
64 const POINT3D *pt = getPoint3d_cp(pa, i);
66 stringbuffer_append_double(sb, pt->x, opts->precision);
68 stringbuffer_append_double(sb, pt->y, opts->precision);
70 stringbuffer_append_double(sb, pt->z, opts->precision);
72 }
73}
#define FLAGS_GET_Z(flags)
Definition liblwgeom.h:165
static const POINT3D * getPoint3d_cp(const POINTARRAY *pa, uint32_t n)
Returns a POINT3D pointer into the POINTARRAY serialized_ptlist, suitable for reading from.
Definition lwinline.h:109
static const POINT2D * getPoint2d_cp(const POINTARRAY *pa, uint32_t n)
Returns a POINT2D pointer into the POINTARRAY serialized_ptlist, suitable for reading from.
Definition lwinline.h:97
static void stringbuffer_append_double(stringbuffer_t *s, double d, int precision)
static void stringbuffer_append_char(stringbuffer_t *s, char c)
double y
Definition liblwgeom.h:390
double x
Definition liblwgeom.h:390
double z
Definition liblwgeom.h:402
double x
Definition liblwgeom.h:402
double y
Definition liblwgeom.h:402
lwflags_t flags
Definition liblwgeom.h:431

References POINTARRAY::flags, FLAGS_GET_Z, getPoint2d_cp(), getPoint3d_cp(), stringbuffer_append_char(), stringbuffer_append_double(), POINT2D::x, POINT3D::x, POINT2D::y, POINT3D::y, and POINT3D::z.

Referenced by asgeojson_point_coords(), and pointArray_to_geojson().

Here is the call graph for this function:
Here is the caller graph for this function: