Hello, I don't know how your differents layers has been made but your problem certainly rely on difference with boundaries even if there are very little different and just one point not into the county, your district will not be select.
If you want to correct that you could use a buffer (st_within(o.geom,st_buffer(k.geom,XX)) big enough to correct the little differences of the boundaries but not too big although you may select too many districts. Hugues. -------- Message d'origine-------- De: postgis-users-boun...@postgis.refractions.net de la part de Michal Zimmermann Date: mer. 10/10/2012 10:27 À: postgis-users@postgis.refractions.net Objet : [postgis-users] Select polygons within polygon with PostGIS 2.0 Hi to all, I have a relation representing all the counties in my country and the other one containing all the districts - e. g. each and every county is composed of several districts. How do I select them with spatial query? I tried with select nazorp from kraje as k, orp_wgs as o WHERE ST_Within(o.geom,k.geom) AND k.nazev = 'Liberecký' // name of the county but had wrong results returned (well, they are probably not wrong, they are just not what I expected them to be). ST_Within only returns districts that don't share a boundary with the county, but I need to get all the districts within the county. Is that possible? I haven't found any built-in function suitable for my needs yet. -- Michal Zimmermann (zimmi) WWW: http://www.zimmi.cz _______________________________________________ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
<<winmail.dat>>
_______________________________________________ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users