[geos-devel] [GEOS] #1142: GeoJSON reader cannot read null coordinates

GEOS geos-trac at osgeo.org
Sat Oct 30 11:51:46 PDT 2021


#1142: GeoJSON reader cannot read null coordinates
-----------------------+--------------------------
 Reporter:  caspervdw  |      Owner:  geos-devel@…
     Type:  defect     |     Status:  new
 Priority:  minor      |  Milestone:  3.11.0
Component:  Default    |    Version:  main
 Severity:  Annoyance  |   Keywords:
-----------------------+--------------------------
 The GeoJSON writer writes NaN coordinates to null.

 {{{
 >>> pygeos.to_geojson(pygeos.Geometry("LINESTRING (1 nan, 2 2)"))
 '{"type":"LineString","coordinates":[[1.0,null],[2.0,2.0]]}'
 }}}

 The inverse operation however does not work:

 {{{
 >>>
 pygeos.from_geojson('{"type":"LineString","coordinates":[[1.0,null],[2.0,2.0]]}')
 GEOSException: ParseException: Error parsing JSON:
 '[json.exception.type_error.302] type must be number, but is null'
 }}}

 There is a lot to say about allowing nan coordinates at all, but as they
 are allowed now and the writer handles them properly, I would expect the
 reader handles them as well.

-- 
Ticket URL: <https://trac.osgeo.org/geos/ticket/1142>
GEOS <http://trac.osgeo.org/geos>
GEOS (Geometry Engine - Open Source) is a C++ port of the Java Topology Suite (JTS).


More information about the geos-devel mailing list