]> granicus.if.org Git - postgis/commitdiff
#2546, GeoJSON with string coordinates parses incorrectly
authorPaul Ramsey <pramsey@cleverelephant.ca>
Fri, 7 Mar 2014 23:20:25 +0000 (23:20 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Fri, 7 Mar 2014 23:20:25 +0000 (23:20 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@12302 b70326c6-7e19-0410-871a-916f4a2858ee

NEWS
liblwgeom/lwin_geojson.c

diff --git a/NEWS b/NEWS
index 732b8ebe051812a5b7ba8cf73319ee9ce2ffb8eb..2da914487ff564f52dfadee98c015c80b3746d1b 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -47,6 +47,7 @@ PostGIS 2.2.0
   - #2534, st_distance is returning incorrect results for large geographies
   - #2540, Change GUC name for GDAL_DATA to postgis.gdal_datapath
   - #2543, invalid join selectivity error from simple query
+  - #2546, GeoJSON with string coordinates parses incorrectly 
   - #2552, Fix handling of NULL raster in ST_AsTIFF, ST_AsPNG
            and ST_AsJPEG
   - #2555, Fix parsing issue of range arguments of ST_Reclass
index e4de54a167e985c8d3b57570cc4c64368c88e31a..87dba66069eca85a27f1d8fc8adc0024f112d783 100644 (file)
@@ -82,29 +82,19 @@ parse_geojson_coord(json_object *poObj, int *hasz, POINTARRAY *pa)
 
                // Read X coordinate
                poObjCoord = json_object_array_get_idx( poObj, 0 );
-               iType = json_object_get_type(poObjCoord);
-               if (iType == json_type_double)
-                       pt.x = json_object_get_double( poObjCoord );
-               else
-                       pt.x = json_object_get_int( poObjCoord );
+               pt.x = json_object_get_double( poObjCoord );
                LWDEBUGF(3, "parse_geojson_coord pt.x = %f.", pt.x );
 
-               // Read Y coordiante
+               // Read Y coordinate
                poObjCoord = json_object_array_get_idx( poObj, 1 );
-               if (iType == json_type_double)
-                       pt.y = json_object_get_double( poObjCoord );
-               else
-                       pt.y = json_object_get_int( poObjCoord );
+               pt.y = json_object_get_double( poObjCoord );
                LWDEBUGF(3, "parse_geojson_coord pt.y = %f.", pt.y );
 
                if( nSize == 3 ) /* should this be >= 3 ? */
                {
-                       // Read Z coordiante
+                       // Read Z coordinate
                        poObjCoord = json_object_array_get_idx( poObj, 2 );
-                       if (iType == 3)
-                               pt.z = json_object_get_double( poObjCoord );
-                       else
-                               pt.z = json_object_get_int( poObjCoord );
+                       pt.z = json_object_get_double( poObjCoord );
                        LWDEBUGF(3, "parse_geojson_coord pt.z = %f.", pt.z );
                        *hasz = LW_TRUE;
                }