<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
Hi Brian,<br>
<blockquote
cite="mid:mailman.1.1261512001.26857.postgis-users@postgis.refractions.net"
type="cite">
<pre wrap="">
</pre>
<blockquote type="cite">
<pre wrap="">I have squares. A lot of squares. Thousands of squares. I would
love
to combine them into one or more larger polygons. But, they must
valid
polygons, non-reentrant. For example. if you have a 3x3 grid of
squares,
ABC
RST
XYZ
and I want to combine all but the center, I would need either 2
polygons
(something like ABC and RXYZT), or one polygon with an inner ring.
</pre>
</blockquote>
<pre wrap="">
Assuming there is a table 'squares' containing a geometry type 'the_geom', this one produces a polygon having an inner ring:
SELECT
ST_Difference(ST_Union(the_geom), (SELECT the_geom FROM squares WHERE id='S'))
FROM squares
Best Regards,
Andreas
</pre>
</blockquote>
<br>
Does this return a multipolyon or a single polygon? I didn't state
this originally, but I have disjointed squares. So if you look at a
grid<font color="#3333ff">:</font><br>
<tt>ABCDEF<br>
OPQRST<br>
UVWXYZ<br>
</tt>I might have ABCEFOQUVW<br>
<tt>ABC EF<br>
O Q<br>
UVW<br>
</tt>So I would want one polygon with ABCQWVU and one with EF<br>
<br>
- Brian<br>
</body>
</html>