107{
109
110 if (json_object_get_type(poObj) == json_type_array)
111 {
112 json_object *poObjCoord = NULL;
113 const int nSize = json_object_array_length(poObj);
114 if (nSize == 0)
116 if (nSize < 2)
117 {
118 lwerror(
"Too few ordinates in GeoJSON");
120 }
121
122
123 poObjCoord = json_object_array_get_idx(poObj, 0);
124 pt.
x = json_object_get_double(poObjCoord);
125
126
127 poObjCoord = json_object_array_get_idx(poObj, 1);
128 pt.
y = json_object_get_double(poObjCoord);
129
130 if (nSize > 2)
131 {
132
133 poObjCoord = json_object_array_get_idx(poObj, 2);
134 pt.
z = json_object_get_double(poObjCoord);
136 }
137 }
138 else
139 {
140
141 lwerror(
"The 'coordinates' in GeoJSON are not sufficiently nested");
143 }
144
146}
int ptarray_append_point(POINTARRAY *pa, const POINT4D *pt, int allow_duplicates)
Append a point to the end of an existing POINTARRAY If allow_duplicate is LW_FALSE,...
#define LW_TRUE
Return types for functions with status returns.
void void lwerror(const char *fmt,...) __attribute__((format(printf
Write a notice out to the error handler.