[postgis-users] GeometryCollection(empty) as intersection result
Andrea Aime
andrea.aime at aliceposta.it
Wed Feb 18 03:46:15 PST 2004
Düster Horst wrote:
> I want to clip a line table by a polygon table with all lines and lineparts
> inside the polygon as result.
>
> The query
>
> create table clip_result as select intersection(poly.wkb_geometry,
> line.wkb_geometry) as wkb_geometry from poly, line
>
> should do that. The lines of the line table where clipped, but the query
> produced tons of empty GeometryCollections additionally.
>
> Any hints?????
This happens because it's a dababase, not a GIS tool :-)
In particular, while performing the join you end up with couples
of geometries that do not intesect, and their intersection is a empty
geometry.
create table clip_result as select intersection(poly.wkb_geometry,
line.wkb_geometry) as wkb_geometry from poly, line where overlaps(poly.wkb_geometry,
line.wkb_geometry)
should do the trick (almost, I haven't tried the query, but you
get the idea). The other problem is that you'll end up with a table
that's not declared in the geometry_columns table, so some tools won't
work properly (won't recognize the generated table as a container of geometric
objects). I don't know if there is an easy way to add the table to
the geometry_columns thought, without having to add it by hand with an INSERT.
Best regards
Andrea Aime
More information about the postgis-users
mailing list