[postgis-devel] [PostGIS] #1996: ST_AsGeoJSON('POINT EMPTY') produces invalid JSON

PostGIS trac at osgeo.org
Fri Nov 2 11:37:17 PDT 2012


#1996: ST_AsGeoJSON('POINT EMPTY') produces invalid JSON
------------------------+---------------------------------------------------
 Reporter:  cdestigter  |       Owner:  pramsey      
     Type:  defect      |      Status:  new          
 Priority:  medium      |   Milestone:  PostGIS 2.1.0
Component:  postgis     |     Version:  trunk        
 Keywords:              |  
------------------------+---------------------------------------------------

Comment(by pramsey):

 Hm, this is an interesting question... given that a non-empty point
 returns this
 {{{
  {"type":"Point","coordinates":[0,0]}
 }}}
 and a non-empty linestring returns this
 {{{
 {"type":"LineString","coordinates":[[0,0],[1,1]]}
 }}}
 I would expect the empty linestring to return an array with zero elements,
 but the coordinates type for the point is not an array, it's just a
 coordinate. So we'd be returning an empty array (dimensionality 1) in the
 empty case, but a singleton coordinate (dimensionality 0) in the non-empty
 case. If that's OK, we can do it. Unfortunately, looks like there is not
 any official guidance on what to do for empty.

-- 
Ticket URL: <http://trac.osgeo.org/postgis/ticket/1996#comment:1>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-devel mailing list