[postgis-users] How do multipolygons work?

Simon Schneider Kallas at gmx.de
Sun Dec 9 10:51:36 PST 2007


Hi,

I've a table with a multigeometry geometry column with only one object 
inserted:

insert into test(name, geom) values('Main', 
GeomFromEWKT('MULTIPOLYGON(((0 0 0, 40 0 0, 40 50 0, 0 50 0, 0 0 0),(40 
0 0, 50 0 0, 50 50 0, 40 50 0, 40 0 0)))'));


And now I wanted to check whether a certain point lies within this 
multipolygon via this query:

SELECT name FROM test WHERE distance(GeomFromText('POINT(45 5)',-1), 
geom)=0;

The thing I don't understand is that above query delivers no result, but 
when I try a query with the point inside the first part of the 
multipolygon like:

SELECT name FROM test WHERE distance(GeomFromText('POINT(20 5)',-1), 
geom)=0;

it returns "Main" as expected.



Can anybody explain to me why the query doesn't return anythin wheng the 
point is in the second polygon?



Cheers,
Simon



More information about the postgis-users mailing list