[postgis-users] General PostGIS & GEOS comments and questions
dblasby at refractions.net
Thu Sep 4 09:42:49 PDT 2003
Thanks for the feedback, Vinko. I've been very busy and havent had much
time to actually do full testing.
Vinko Vrsalovic wrote:
> I guess you are aware of this, but just in case, with the latest
> cvs code, when passing a wrong parameter (typically geometry
> collections, I guess this is the reason for the warning in the docs :))
> to a GEOS powered function, postgres (7.3.4) crashes.
> boundary(), when passed a geometry collection, throws an error
> but it doesn't crash the server.
Almost all the GEOS functions should throw an error if you have a
GeometryCollection as an argument. This is because the symantics of a
GeometryCollection for most operations are illdefined. The Geos or JTS
list would be a better place to discuss the details of this.
I havent been able to reproduce your bug - could you give me an example
that crashes the server?
> Will there ever be support for geometry collections on GEOS
> powered functions, at least for some of them? Is this possible
> at all in all (or any) cases?
I'll forward your message to the GEOS list (geos-devel at geos.refractions.net)
> And a related issue, is there/will there be a function to obtain
> an envelope of the actual geometries, not their bounding boxes?
OGC defines the envelope of a geometry as it's bounding box.
Will return the bounding box as a POLYGON.
> In fact, what I'm looking for is to be able to do a
> contains(geom,collect(other_geom)), where geom is a POLYGON
> column, and other_geom is a column of GEOMETRY type, which
> has different types of geometries. So far, the closest I've
> arrived is to obtain the envelope()'s of the collect()'s, and
> then contains(geom,envelope).
I've not sure what you're trying to do here.
Are you trying to find geometries in one table ("other_geom") that are
contained by a polygon in another table ("geom").
If so, then something like:
SELECT distinct * FROM table_polygon, table_other_geom WHERE
contains(table_polygon.geom, table_other_geom.other_geom) AND
table_polygon.geom && table_other_geom.other_geom
should be giving you what you want.
* remember, this is testing each geometry against a single polygon.
This isnt doing any polygon dissolving.
If your geometry ("other_geom") is multiparted, all the parts have
to be contained by one polygon.
I have seen a lot of use for a union(<geometrycollection>) function.
Its implementation would be something like:
accum = initial_geometry.getGeometryN(0).union(
accum = accum.union(
accum = accum.union(
More information about the postgis-users