[postgis-users] Can I create a Polygon using Points rather than x y coordinates
robert.coup at onetrackmind.co.nz
Mon Jan 19 11:11:29 PST 2009
On Tue, Jan 20, 2009 at 3:37 AM, DonnaR <donna at therudds.co.uk> wrote:
> Can I construct a Polygon from a set of (already constructed) Points? The
> way seems to be by 'creating' the Points implicitly ie POLYGON(x y, x
> y,...), but I have already constructed the geometry Points (so I can do
> other processsing on them first) and so just need to pass them in as Points
> to the Polygon constructor.
Have a look at ST_MakePolygon, ST_MakeLine, and ST_LineFromMultiPoint...
Maybe something like:
SELECT ST_MakePolygon(ST_MakeLine(p)) FROM (SELECT p FROM mypoints ORDER BY
index) AS mypointsordered;
Note that the linestring must be closed before you can successfully call
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the postgis-users