[postgis-users] Polygon from a set of points

Kevin Neufeld kneufeld at refractions.net
Tue Jun 12 13:29:12 PDT 2007


I see. Yes, it's certainly possible. Since you are coming straight from 
text, I think the easiest for you would be to use geomfromtext() method.

SELECT GeomFromText('POLYGON((-67.84208673890122 -31.89216012405324, 
-67.84097873325344 -31.8878559482676, ...))');

Note: you can optionally add the SRID of the projection you are in as a 
second parameter if you plan on performing any projection operations.

Is that what you were after?

-- Kevin

Leonardo Mateo wrote:
> On 6/12/07, Kevin Neufeld <kneufeld at refractions.net> wrote:
>> Have you tried using convexhull(geometry)? Given a collection of points,
>> it'll return a polygon where every point is guaranteed to be inside the
>> polygon.
>> ie.
>> SELECT convexhull(collect(makepoint(x,y))) FROM mytable;
> That's the point, I don't have them on a table. I mean, (x,y) pairs
> will came on plain text. Must I insert them on a temp table? There's
> no chance to make a polygon from (x,y) pairs "on the fly"?
> Sorry if my question is too dumb, I don't have experience with all 
> this stuff.
>
> Thanx a lot in advance.
>
>



More information about the postgis-users mailing list