<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Thanks for help, but it still looks like union fills in the gap so to speak, any more ideas? </div><div><b><br></b></div><div><b>SELECT ST_AsEWKT(ST_Union(the_geom)) as the_geom</b></div><div><b>FROM postcode_sectors </b></div><div><b>WHERE postarea = 'LN'</b></div><div><br></div><div>"SRID=4269;POLYGON((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.775752949336526 53.2466816979897,-0.764778898530289 53.2691344556123,-0.751456893012603 53.3202408495374,-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))"</div><div><br></div><div><b>SELECT ST_AsEWKT(ST_Union(the_geom)) as the_geom</b></div><div><b>FROM postcode_sectors </b></div><div><b>WHERE com_dist = 'LN1'</b></div><div><br></div><div>"SRID=4269;POLYGON((-0.567075865458079 53.3529438083222,-0.541250872030082 53.3316560575988,-0.53867243559146 53.2902048795337,-0.538372820842824 53.2545802514289,-0.536621729986015 53.2443903523506,-0.537587144360509 53.23365835124,-0.539261287526225 53.2285001962972,-0.542511758566372 53.2276409117944,-0.567956817933028 53.233334871246,-0.570638045173646 53.2342660459289,-0.574252637693809 53.2359726746639,-0.640114978977996 53.2538783112452,-0.668182682830745 53.2552110975952,-0.775752949336526 53.2466816979897,-0.764778898530289 53.2691344556123,-0.751456893012603 53.3202408495374,-0.567075865458079 53.3529438083222))"</div><div><b><br></b></div><div><b>SELECT postarea, com_dist, gid</b></div><div><b>FROM postcode_sectors</b></div><div><b>WHERE postarea = 'LN' AND NOT com_dist = 'LN1'</b></div><div><b>ORDER BY postarea, com_dist</b></div><div><br></div><div>"LN";"LN10";4942</div><div>"LN";"LN10";4941</div><div>"LN";"LN11";4946</div><div>"LN";"LN11";4943</div><div>"LN";"LN11";4944</div><div>"LN";"LN11";4945</div><div>"LN";"LN12";4947</div><div>"LN";"LN12";4948</div><div>"LN";"LN13";4949</div><div>"LN";"LN13";4950</div><div>"LN";"LN2";4912</div><div>"LN";"LN2";4914</div><div>"LN";"LN2";4915</div><div>"LN";"LN2";4913</div><div>"LN";"LN2";4916</div><div>"LN";"LN3";4918</div><div>"LN";"LN3";4917</div><div>"LN";"LN4";4922</div><div>"LN";"LN4";4920</div><div>"LN";"LN4";4919</div><div>"LN";"LN4";4921</div><div>"LN";"LN5";4926</div><div>"LN";"LN5";4923</div><div>"LN";"LN5";4924</div><div>"LN";"LN5";4925</div><div>"LN";"LN6";4927</div><div>"LN";"LN6";4932</div><div>"LN";"LN6";4928</div><div>"LN";"LN6";4929</div><div>"LN";"LN6";4931</div><div>"LN";"LN6";4933</div><div>"LN";"LN6";4930</div><div>"LN";"LN7";4934</div><div>"LN";"LN8";4937</div><div>"LN";"LN8";4936</div><div>"LN";"LN8";4935</div><div>"LN";"LN8";4938</div><div>"LN";"LN9";4939</div><div>"LN";"LN9";4940</div><div><br></div><div><br></div><div><br></div><div><br></div><div><b>From: </b><span class="Apple-tab-span" style="white-space:pre"><b> </b></span><b><a href="mailto:lr@pcorp.us">lr@pcorp.us</a></b></div><div><b>Subject: </b><span class="Apple-tab-span" style="white-space:pre"><b> </b></span><b>RE: [postgis-users] Union, but need to exclude any void</b></div><div><b>Date: </b><span class="Apple-tab-span" style="white-space:pre"><b> </b></span><b>1 November 2008 19:23:09 GMT</b></div><div><b>To: </b><span class="Apple-tab-span" style="white-space:pre"><b> </b></span><b><a href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a></b></div><div><b>Reply-To: </b><span class="Apple-tab-span" style="white-space:pre"><b> </b></span><b><a href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a></b></div><div><br></div><div>Toby,</div><div>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</div><div>you had something like ln1 instead of LN1 in the com_dist field, then the ln1s would be picked up as NOT ....</div><div> </div><div>To rule out ST_Union as the culprit, can you do a simple attribute query</div><div> </div><div>SELECT postarea, com_dist, gid</div><div>FROM postcode_sectors</div><div>WHERE postarea = 'LN' AND NOT com_dist = 'LN1'</div><div>ORDER BY postarea, com_dist</div><div> </div><div>Also I tend to do com_dist <> 'LN1' , but that shouldn't matter.</div><div> </div><div>Hope that helps,</div><div>Regina</div></body></html>