[postgis-users] Union, but need to exclude any void
Paragon Corporation
lr at pcorp.us
Sat Nov 1 12:23:09 PDT 2008
Toby,
I agree with Stanley that it is probably not a ST_Union problem. I'm
guessing there is something wrong with your WHERE clause. Keep in mind
PostgreSQL is case sensitive so if by chance
you had something like ln1 instead of LN1 in the com_dist field, then the
ln1s would be picked up as NOT ....
To rule out ST_Union as the culprit, can you do a simple attribute query
SELECT postarea, com_dist, gid
FROM postcode_sectors
WHERE postarea = 'LN' AND NOT com_dist = 'LN1'
ORDER BY postarea, com_dist
Also I tend to do com_dist <> 'LN1' , but that shouldn't matter.
Hope that helps,
Regina
_____
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Toby
Rainthorpe
Sent: Saturday, November 01, 2008 2:19 PM
To: PostGIS Users Discussion
Subject: Re: [postgis-users] Union, but need to exclude any void
Sadly it doesn't work, here is a search for the post code area LN, but
excluding LN1. This should give the polygon of lincoln, with the exception
of the town centre district. Instead it creates a polygon for the whole LN
post area.
Just to clarify, I do want the hole in a polygon.
SELECT ST_AsKML(ST_Union(the_geom)) as the_geom
FROM postcode_sectors
WHERE postarea = 'LN' AND NOT com_dist = 'LN1'
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Placemark>
<Polygon><outerBoundaryIs><LinearRing><coordinates>-0.574252637693809,53.235
9726746639 -0.570638045173646,53.2342660459289
-0.567956817933028,53.233334871246 -0.542511758566372,53.2276409117944
-0.539261287526225,53.2285001962972 -0.537587144360509,53.23365835124
-0.536621729986015,53.2443903523506 -0.538372820842824,53.2545802514289
-0.53867243559146,53.2902048795337 -0.541250872030082,53.3316560575988
-0.567075865458079,53.3529438083222 -0.549064460589285,53.4257467252708
-0.461252440918993,53.4290079476242 -0.459280037729661,53.4356804144195
-0.491910432874966,53.497600359203 -0.41389940584748,53.5500565803702
-0.310449877650045,53.5267476031091 -0.219352544114183,53.5272954168687
-0.215026390840363,53.5063814691382 -0.203265094143773,53.466744705434
-0.122544300870874,53.4548941206983 0.0264268890418949,53.4620080919002
0.083849617015283,53.496544395631 0.228359151391426,53.408400422663
0.268028563946318,53.342544544341 0.302708719734213,53.2940795243504
0.321850405882593,53.2715163271867 0.234840151689661,53.1942224753385
0.194430850648443,53.213308161178 0.169714736355569,53.2124120839752
0.0834492984598471,53.2348844372266 0.0208307835734331,53.2478135975227
-0.0126938531249155,53.1710150547887 -0.13716904881661,53.1418544045366
-0.150749526290076,53.1243892073786 -0.130710137006856,53.0239835120991
-0.229285061035197,53.0038950480853 -0.338497757654447,53.0609112327498
-0.408675738441825,53.055621865059 -0.452241950934627,53.0579499714055
-0.52047527802287,53.0487392813369 -0.660214167307015,53.0546658032031
-0.714807399468163,53.0584148660486 -0.699290317426583,53.0756434022022
-0.716927624544292,53.1105928908201 -0.674018446595594,53.2187206490539
-0.668182682830745,53.2552110975952 -0.640114978977996,53.2538783112452
-0.574252637693809,53.2359726746639</coordinates></LinearRing></outerBoundar
yIs></Polygon>
</Placemark>
</kml>
From: ssufficool at rov.sbcounty.gov
Subject: RE: [postgis-users] Union, but need to exclude any void
Date: 1 November 2008 14:58:26 GMT
To: postgis-users at postgis.refractions.net
Reply-To: postgis-users at postgis.refractions.net
I've never had a problem with st_union including holes when it
shouldn't. Your query syntax is a bit odd though. Maybe try the
following:
SELECT ST_Union(the_geom) as the_geom
FROM territories
WHERE is_an_outer_territory = 1
-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On
Behalf Of Toby Rainthorpe
Sent: Saturday, November 01, 2008 1:37 AM
To: PostGIS Users Discussion
Subject: [postgis-users] Union, but need to exclude any void
I have a list of territories, say 9 represented by a tic, tac, toe
board (3 x 3 grid ). A query selects all the outer perimeter (8
territories), but omits the central block. If i were then to union
this group the resulting polygon would fill, or include this central
block, even though I have not exclusively said that that
territory has
been selected.
Is there a way of doing a union, or another method on a set of
polygons that will result in a polygon being created, but allow for
the void not to be included.
Thanks for your help,
Toby
SELECT
GeomUnion(geom) as the_geom,
FROM (
SELECT (dump(the_geom)).geom FROM territories WHERE
is_an_outer_territory = 1
)
_______________________________________________
postgis-users mailing list postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users
_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20081101/0f5870bc/attachment.html>
More information about the postgis-users
mailing list