[postgis-users] point in polygon using operator &&
Rosangela Silva
rosangela.silva at zenitpolar.com.br
Tue May 20 11:53:10 PDT 2003
Hello all,
I'm trying to use the operator && to find the polygon
that contains a point. (Are there other way to do this in PostGIS?)
So, I create the select below:
SELECT continent_name
FROM continent
WHERE the_geom && GeometryFromText('BOX3D(-45.69439 -23.5642, -45.69439 -23.5642)'::box3d,-1);
How the point doesn't have a box, I repeat the same coordinates.
The continent is the world continent table.
The result was: South America, Oceania.
I became surprise by Oceania and I saw that Oceania is a multpolygon geometry.
When the PostGIS generate the box of Oceania polygons, the result are the box resultant
of all box isolated polygons. By this, my point is in Oceania too.
See the select bellow:
gisdb=# select continent, box3D(the_geom) from continent where continent='Oceania';
continent | box3d
---------------+--------------------------------------------------------
Oceania | BOX3D(-180 -52.5780563354492 0,180 28.2215194702148 0)
In another case, but in this case I didn't understand why, the result get 2 polygons having the
same point, but this point ins't in the border of two polygons (I visually have shure!).
gisdb=# SELECT nomemunicp, uf FROM brmuni WHERE the_geom && GeometryFromText
('BOX3D(-45.69439 -23.5642, -45.69439 -23.5642)'::box3d,-1);
nomemunicp | uf
-----------------------+----
PARAIBUNA | SP
CARAGUATATUBA | SP
Thanks
Rosângela
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20030520/34d71102/attachment.html>
More information about the postgis-users
mailing list