[postgis-devel] GeoJSON failing on 1.4

Mark Cave-Ayland mark.cave-ayland at siriusit.co.uk
Tue Jan 13 06:41:10 PST 2009


Obe, Regina wrote:

> Yap works now for both geojson and kml so its still just that nagging
> regress_bdpoly which I guess we haven't resolved yet. 

It actually comes down to your current discussion on the GEOS list about 
the Z coordinate: 
http://lists.osgeo.org/pipermail/geos-devel/2009-January/003839.html.

For some reason, ST_BuildArea() returns the wrong Z coordinate for the 
regression tests which causes the returned polygon to have an unclosed 
ring if you consider 3 dimensions. You can clearly see this from the 
following output on 1.3:


postgis13=# select st_asewkt(st_geomfromtext('SRID=2;LINESTRING(0 0 2, 
10 0 4, 10 10 6, 0 10 8, 0 0 10)'));
WARNING:  OGC WKT expected, EWKT provided - use GeomFromEWKT() for this
CONTEXT:  SQL function "st_geomfromtext" statement 1
                        st_asewkt
-------------------------------------------------------
  SRID=2;LINESTRING(0 0 2,10 0 4,10 10 6,0 10 8,0 0 10)
(1 row)

postgis13=# select 
st_asewkt(st_buildarea(st_geomfromtext('SRID=2;LINESTRING(0 0 2, 10 0 4, 
10 10 6, 0 10 8, 0 0 10)')));
WARNING:  OGC WKT expected, EWKT provided - use GeomFromEWKT() for this
CONTEXT:  SQL function "st_geomfromtext" statement 1
                       st_asewkt
------------------------------------------------------
  SRID=2;POLYGON((0 0 10,0 10 8,10 10 6,10 0 4,0 0 2))
(1 row)


Since 1.4 nicely unifies the parser/unparser code, the back-conversion 
from GEOS to EWKT now trips the closed ring check which is why we now 
see the error.

I think the issue on hand is how closure is defined in the spec for 
geometries with > 2 dimensions, and hence whether the bug lies within 
GEOS or not. Martin, any comments?


ATB,

Mark.

-- 
Mark Cave-Ayland
Sirius Corporation - The Open Source Experts
http://www.siriusit.co.uk
T: +44 870 608 0063



More information about the postgis-devel mailing list