[postgis-users] ST_Disjoint function
Lee Meilleur
lee.meilleur at gis.leg.mn
Wed Mar 25 15:20:34 PDT 2009
Hello,
I'm running a contiguity check using the ST_Disjoint function. The results list the number of distinct polygons for a redistricting plan, some disjoint and some touching on a corner. I need to distinguish between the two and also show the total of all. To test this, I created a dataset that contains 2 sets of disjoint polygons. When I run the ST_Disjoint expression, the district with 3 disjoint polygons is listed as having 6, while the district with 2 disjoint polygons is listed as having 2. The feature type in this layer is polygon. The expression I'm using is:
SELECT a.district, count(a.district) FROM planfile AS a, planfile AS b WHERE a.district = b.district AND ST_Disjoint(a.the_geom, b.the_geom) GROUP BY a.district;
Results:
district | count
----------+----------
17B | 6 (incorrect)
26B | 2 (correct)
Am I missing something? Viewing the data in Quantum GIS shows three disjoint polygons for district 17B and three unique records in the attribute table.
I took this further and added another set of disjoint polygons. At first just two, and the ST_Disjoint function shows two. But when I increased it to four, the ST_Disjoint function came up with twelve.
I've tested this on two different PostGIS servers with the same results:
POSTGIS="1.3.2" GEOS="3.0.0-CAPI-1.4.1" PROJ="Rel. 4.6.0 Dec 2007 USE_STATS
POSTGIS="1.3.5" GEOS="3.0.3-CAPI-1.4.2" PROJ="Rel. 4.6.1 21 August 2008 "USE_STATS
Thanks in advance for any help.
Lee Meilleur
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20090325/3876afaa/attachment.html>
More information about the postgis-users
mailing list