[geos-devel] [GEOS] #725: GEOS allows relate ops on GeometryCollection, while JTS and PostGIS do not
GEOS
geos-trac at osgeo.org
Mon Apr 13 04:35:00 PDT 2015
#725: GEOS allows relate ops on GeometryCollection, while JTS and PostGIS do not
------------------------+---------------------------------------------------
Reporter: mwtoews | Owner: geos-devel@…
Type: task | Status: new
Priority: minor | Milestone: GEOS Future
Component: Default | Version: svn-trunk
Severity: Unassigned | Keywords:
------------------------+---------------------------------------------------
GEOS currently allows relate ops on GEOMETRYCOLLECTION geometries, e.g.
with Shapely:
{{{
from shapely.wkt import loads
g1 = loads('GEOMETRYCOLLECTION(POINT(1 2),POINT(3 4))')
g2 = loads('GEOMETRYCOLLECTION(POINT(3 4),POINT(1 2))')
print(g1.equals(g2)) # True
print(g1.relate(g2)) # 0FFFFFFF2
}}}
or with R
{{{
library(rgeos)
g1 <- readWKT("GEOMETRYCOLLECTION(POINT(1 2),LINESTRING(3 4, 5 6))")
g2 <- readWKT("GEOMETRYCOLLECTION(LINESTRING(3 4, 5 6),POINT(1 2))")
g3 <- readWKT("GEOMETRYCOLLECTION(LINESTRING(3 4, 5 6),POINT(1 1))")
gEquals(g1, g2) # [1] TRUE
gRelate(g1, g2) # [1] "1FFF0FFF2"
gRelate(g1, g3) # [1] "1F0F0F0F2"
}}}
PostGIS and JTS do not allow these operations, see email threads:
* http://lists.osgeo.org/pipermail/postgis-devel/2015-April/024827.html
* http://lists.osgeo.org/pipermail/postgis-devel/2015-April/024829.html
In particular, the rationale for the restriction in JTS from Martin Davis:
> It's because GeometryCollection have no inherent topology. In other
words,
> geometry components can overlap. To compute relationships with a
geometry
> with overlapping components the components have to be merged to form a
> topologically valid arrangement. This is more complex and more
> computationally expensive than the rest of the relate algorithm. So
> basically it just didn't get done. (It would also introduce potential
> robustness issues, which I was hoping to avoid in the relate code.
> A few relationships (eg intersects and disjoint) could be computed more
> easily, so they could have special case code added for them more easily.
This task is to assess the situation for GEOS, whether a similar
restriction should be set for relate ops, or any other changes. Note that
I haven't found a case that returns a bad result, but I haven't looked
hard.
--
Ticket URL: <http://trac.osgeo.org/geos/ticket/725>
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