[postgis-users] contains more than 1 Object

Nicolas Ribot nicolas.ribot at gmail.com
Mon Nov 22 10:18:26 PST 2010


On 11 November 2010 20:00,  <jj.wag at gmx.de> wrote:
> Hi all,
> I have following SQL-Statement:
>
> UPDATE objektzentral SET gemeinde = grenzen.gemeinde FROM grenzen WHERE
> CONTAINS(grenzen.the_geom, objektzentral.the_geom);
>
> The table „objektzentral“ is a GeometryColletion, so the SQL works fine with
> point-data because there is only one result possible.
> But if there is a polygon or line-object in "objektzentral" and it contains
> more than 1 object in “grenzen.the_geom” I get no value.
> My questions:
> 1. How can I get all objects that contain the object (e.g. comma separated)?
>
> 2. Is it possible to set a percent-value e.g. “contains more than 90%” ?
>
>

Hi,

The ST_Contains documentation states:
"Do not call with a GEOMETRYCOLLECTION as an argument"

You could try to explode your geometryCollection (using st_dump)  and
to call st_contains with individual geometries.
Concerning the percentage of coverage, you could compute the
intersection area and compare it to the geometry's area: have a look
at st_intersection.

Nicolas



More information about the postgis-users mailing list