[postgis-users] General PostGIS & GEOS comments and questions

Vinko Vrsalovic vinko at cprsig.cl
Thu Sep 4 10:14:17 PDT 2003

> I havent been able to reproduce your bug - could you give me an example 
> that crashes the server?
I'll prepare a small set of data and sql and send it before Monday.
> 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.
Exactly, that was what i first tried to do, but the problem is that
other_geom is a multityped column, it has polygons, points, lines and
collections and when calling the exact same query, the server crashes.

I guess I'll have to redesign the model to separate the other_geom into
basic types... will contains() work on generic column types if each
row is not a collection? It seems to me that it would...
> I have seen a lot of use for a union(<geometrycollection>) function.
> Its implementation would be something like:
> accum = initial_geometry.getGeometryN(0).union( 		
> 		initial_geometry.getGeometryN(1) );
> accum = accum.union( 		
> 		initial_geometry.getGeometryN(2) );
> accum = accum.union( 		
> 		initial_geometry.getGeometryN(3) );
> ....
> return accum;

thanks, I'll give this a shot.

Vinko Vrsalovic <el[|- at -|]vinko.cl>

More information about the postgis-users mailing list