Hi Donna,<br><br><div class="gmail_quote">On Tue, Jan 20, 2009 at 3:37 AM, DonnaR <span dir="ltr"><<a href="mailto:donna@therudds.co.uk">donna@therudds.co.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
Can I construct a Polygon from a set of (already constructed) Points? The std<br>
way seems to be by 'creating' the Points implicitly ie POLYGON(x y, x<br>
y,...), but I have already constructed the geometry Points (so I can do some<br>
other processsing on them first) and so just need to pass them in as Points<br>
to the Polygon constructor.</blockquote><div><br>Have a look at ST_MakePolygon, ST_MakeLine, and ST_LineFromMultiPoint...<br><br><a href="http://postgis.refractions.net/documentation/manual-1.3/ch06.html#id2748776">http://postgis.refractions.net/documentation/manual-1.3/ch06.html#id2748776</a><br>
<br>Maybe something like:<br>SELECT ST_MakePolygon(ST_MakeLine(p)) FROM (SELECT p FROM mypoints ORDER BY index) AS mypointsordered;<br><br>Note that the linestring must be closed before you can successfully call MakePolygon()<br>
<br>HTH,<br><br>Rob :)<br></div></div>