[postgis-devel] GeoJSON failing on 1.4

Martin Davis mbdavis at refractions.net
Mon Jan 19 10:31:10 PST 2009


AFAIK the SFS spec is silent on how "closed" should be defined in the 
Z-dimension.

FWIW JTS (and I assume GEOS) explicitly does not check the Z-ordinate 
when checking whether a ring is closed or not.  But JTS doesn't really 
try to provide full 2.5 D semantics - since you're trying to address 
this in PostGIS, you might want to take a more rigorous approach.

M

Mark Cave-Ayland wrote:
> 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.
>

-- 
Martin Davis
Senior Technical Architect
Refractions Research, Inc.
(250) 383-3022




More information about the postgis-devel mailing list