build a polygon from points

View: New views
10 Messages — Rating Filter:   Alert me  

build a polygon from points

by Caspa :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi everybody,
I'm new to postgis...
how can i build a polygon starting from points and not from x,y coord?

i have a table built like this:

point1 | point2 | point3 | point4 | polygon

guess i have to use MakeLine and MakePolygon but i can't fugure out why...
thanks in advance

Andrea
_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users

Re: build a polygon from points

by Paragon Corporation-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Andrea,
Are those individual records or columns in the table?

Take a look at ST_MakeLine, ST_MakePolygon, ST_BuildArea

http://postgis.refractions.net/documentation/manual-svn/ST_MakeLine.html

http://postgis.refractions.net/documentation/manual-svn/ST_BuildArea.html

http://postgis.refractions.net/documentation/manual-svn/ST_MakePolygon.html


You build a line from points with ST_MakeLine and then do a ST_BuildArea or
ST_MakePolygon depending on your desired effect.

Leo

 

-----Original Message-----
From: postgis-users-bounces@...
[mailto:postgis-users-bounces@...] On Behalf Of Caspa
Sent: Monday, June 22, 2009 10:15 AM
To: postgis-users@...
Subject: [postgis-users] build a polygon from points

Hi everybody,
I'm new to postgis...
how can i build a polygon starting from points and not from x,y coord?

i have a table built like this:

point1 | point2 | point3 | point4 | polygon

guess i have to use MakeLine and MakePolygon but i can't fugure out why...
thanks in advance

Andrea
_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users


_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users

Re: build a polygon from points

by Caspa :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi, thanks for that,
those are colunm in the table :

       coord1  |     coord2    |  coord3       |  coord4      |  pol
----------------------------------------------------+--------------------
 geom_data | geom_data | geom_data | geom_data |  I WANT THIS

I tried with this but didnt work;

SELECT ST_MakePoly(ST_MakeLine(coord1, coord2, coord3, coord4, coord5, coord1 ) from table

the problem is that I can't make i line from more than two points ( i'm using postgis v 1.3.5 and geometry ST_MakeLine(geometry[] point_array); doesn't work)
I'm trying to figure out how to use

geometry ST_MakeLine(geometry set pointfield);

but how do I build a geometry set pointfield???
sorry...really beginner!!






2009/6/22 Paragon Corporation <lr@...>
Andrea,
Are those individual records or columns in the table?

Take a look at ST_MakeLine, ST_MakePolygon, ST_BuildArea

http://postgis.refractions.net/documentation/manual-svn/ST_MakeLine.html

http://postgis.refractions.net/documentation/manual-svn/ST_BuildArea.html

http://postgis.refractions.net/documentation/manual-svn/ST_MakePolygon.html


You build a line from points with ST_MakeLine and then do a ST_BuildArea or
ST_MakePolygon depending on your desired effect.

Leo



-----Original Message-----
From: postgis-users-bounces@...
[mailto:postgis-users-bounces@...] On Behalf Of Caspa
Sent: Monday, June 22, 2009 10:15 AM
To: postgis-users@...
Subject: [postgis-users] build a polygon from points

Hi everybody,
I'm new to postgis...
how can i build a polygon starting from points and not from x,y coord?

i have a table built like this:

point1 | point2 | point3 | point4 | polygon

guess i have to use MakeLine and MakePolygon but i can't fugure out why...
thanks in advance

Andrea
_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users


_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users


_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users

Parent Message unknown Re: build a polygon from points

by Nicklas Avén :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Try this
haven't tried it myself
 
SELECT ST_MakePoly(ST_LineFromMultiPoint(ST_collect(coord1, coord2, coord3, coord4, coord5, coord1 ))) from table
greetings
Nicklas
 
ST_LineFromMultiPoint

2009-06-23 Caspa wrote:

Hi, thanks for that,
>those are colunm in the table :
>
>       coord1  |     coord2    |  coord3       |  coord4      |  pol
> ----------------------------------------------------+--------------------
>  geom_data | geom_data | geom_data | geom_data |  I WANT THIS
>
>I tried with this but didnt work;
>
>SELECT ST_MakePoly(ST_MakeLine(coord1, coord2, coord3, coord4, coord5, coord1 ) from table
>
>the problem is that I can't make i line from more than two points ( i'm using postgis v 1.3.5 and geometry ST_MakeLine(geometry[] point_array); doesn't work)
> I'm trying to figure out how to use
>
>geometry ST_MakeLine(geometry set pointfield);
>
>but how do I build a geometry set pointfield???
>sorry...really beginner!!
>
>
>
>
>
>
>>
2009/6/22 Paragon Corporation <lr@...>
>Andrea,
> Are those individual records or columns in the table?
>
> Take a look at ST_MakeLine, ST_MakePolygon, ST_BuildArea
>
>postgis.refractions.net/documentation/manual-svn/ST_MakeLine.html
>
>postgis.refractions.net/documentation/manual-svn/ST_BuildArea.html
>
>postgis.refractions.net/documentation/manual-svn/ST_MakePolygon.html
>
>
> You build a line from points with ST_MakeLine and then do a ST_BuildArea or
> ST_MakePolygon depending on your desired effect.
>
> Leo
>>
>
 
>

>
>
> -----Original Message-----
> From: postgis-users-bounces@...
> [mailto:postgis-users-bounces@...] On Behalf Of Caspa
> Sent: Monday, June 22, 2009 10:15 AM
> To: postgis-users@...
> Subject: [postgis-users] build a polygon from points
>
> Hi everybody,
> I'm new to postgis...
> how can i build a polygon starting from points and not from x,y coord?
>
> i have a table built like this:
>
> point1 | point2 | point3 | point4 | polygon
>
> guess i have to use MakeLine and MakePolygon but i can't fugure out why...
> thanks in advance
>
> Andrea
>
_______________________________________________
> postgis-users mailing list
>postgis-users@...
>postgis.refractions.net/mailman/listinfo/postgis-users
>
>
> _______________________________________________
> postgis-users mailing list
>postgis-users@...
>postgis.refractions.net/mailman/listinfo/postgis-users
>

>
_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users

Parent Message unknown Re: build a polygon from points

by Nicklas Avén :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

About st_makeline an array is needed like this example:
select st_makepolygon(ST_MakeLine(array[st_point(3, 2),st_point(2, 2),st_point(3, 3),st_point(2, 5),st_point(5, 5),st_point(3, 2)]));
 
greetings
Nicklas

2009-06-23 Caspa wrote:

Hi, thanks for that,
>those are colunm in the table :
>
>       coord1  |     coord2    |  coord3       |  coord4      |  pol
> ----------------------------------------------------+--------------------
>  geom_data | geom_data | geom_data | geom_data |  I WANT THIS
>
>I tried with this but didnt work;
>
>SELECT ST_MakePoly(ST_MakeLine(coord1, coord2, coord3, coord4, coord5, coord1 ) from table
>
>the problem is that I can't make i line from more than two points ( i'm using postgis v 1.3.5 and geometry ST_MakeLine(geometry[] point_array); doesn't work)
> I'm trying to figure out how to use
>
>geometry ST_MakeLine(geometry set pointfield);
>
>but how do I build a geometry set pointfield???
>sorry...really beginner!!
>
>
>
>
>
>
>>
2009/6/22 Paragon Corporation <lr@...>
>Andrea,
> Are those individual records or columns in the table?
>
> Take a look at ST_MakeLine, ST_MakePolygon, ST_BuildArea
>
>postgis.refractions.net/documentation/manual-svn/ST_MakeLine.html
>
>postgis.refractions.net/documentation/manual-svn/ST_BuildArea.html
>
>postgis.refractions.net/documentation/manual-svn/ST_MakePolygon.html
>
>
> You build a line from points with ST_MakeLine and then do a ST_BuildArea or
> ST_MakePolygon depending on your desired effect.
>
> Leo
>>
>
 
>

>
>
> -----Original Message-----
> From: postgis-users-bounces@...
> [mailto:postgis-users-bounces@...] On Behalf Of Caspa
> Sent: Monday, June 22, 2009 10:15 AM
> To: postgis-users@...
> Subject: [postgis-users] build a polygon from points
>
> Hi everybody,
> I'm new to postgis...
> how can i build a polygon starting from points and not from x,y coord?
>
> i have a table built like this:
>
> point1 | point2 | point3 | point4 | polygon
>
> guess i have to use MakeLine and MakePolygon but i can't fugure out why...
> thanks in advance
>
> Andrea
>
_______________________________________________
> postgis-users mailing list
>postgis-users@...
>postgis.refractions.net/mailman/listinfo/postgis-users
>
>
> _______________________________________________
> postgis-users mailing list
>postgis-users@...
>postgis.refractions.net/mailman/listinfo/postgis-users
>

>
_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users

Re: build a polygon from points

by Caspa :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

yeah this could be the solution...unfortunately I have postgis version 1.3.5 and i doesn't have this feature yet..(I'm on debian system and don't want to build from source)


>SELECT ST_MakePoly(ST_
>LineFromMultiPoint(ST_collect(coord1, coord2, coord3, coord4, coord5, coord1 ))) from table

this doesn't work, but I'm trying to use LineFromMultiPoint in other ways...maybe it works...

THANKS

SELECT ST_MakePoly(ST_
LineFromMultiPoint(ST_collect(coord1, coord2, coord3, coord4, coord5, coord1 ))) from table


2009/6/23 <nicklas.aven@...>
About st_makeline an array is needed like this example:
select st_makepolygon(ST_MakeLine(array[st_point(3, 2),st_point(2, 2),st_point(3, 3),st_point(2, 5),st_point(5, 5),st_point(3, 2)]));
 
greetings
Nicklas


2009-06-23 Caspa wrote:

Hi, thanks for that,
>those are colunm in the table :
>
>       coord1  |     coord2    |  coord3       |  coord4      |  pol
> ----------------------------------------------------+--------------------
>  geom_data | geom_data | geom_data | geom_data |  I WANT THIS
>
>I tried with this but didnt work;
>
>SELECT ST_MakePoly(ST_MakeLine(coord1, coord2, coord3, coord4, coord5, coord1 ) from table
>
>the problem is that I can't make i line from more than two points ( i'm using postgis v 1.3.5 and geometry ST_MakeLine(geometry[] point_array); doesn't work)
> I'm trying to figure out how to use
>
>geometry ST_MakeLine(geometry set pointfield);
>
>but how do I build a geometry set pointfield???
>sorry...really beginner!!
>
>
>
>
>
>
>>
2009/6/22 Paragon Corporation <lr@...>
>Andrea,
> Are those individual records or columns in the table?
>
> Take a look at ST_MakeLine, ST_MakePolygon, ST_BuildArea
>
>postgis.refractions.net/documentation/manual-svn/ST_MakeLine.html
>
>postgis.refractions.net/documentation/manual-svn/ST_BuildArea.html
>
>postgis.refractions.net/documentation/manual-svn/ST_MakePolygon.html
>
>
> You build a line from points with ST_MakeLine and then do a ST_BuildArea or
> ST_MakePolygon depending on your desired effect.
>
> Leo
>>
>
 
>

>
>
> -----Original Message-----
> From: postgis-users-bounces@...
> [mailto:postgis-users-bounces@...] On Behalf Of Caspa
> Sent: Monday, June 22, 2009 10:15 AM
> To: postgis-users@...
> Subject: [postgis-users] build a polygon from points
>
> Hi everybody,
> I'm new to postgis...
> how can i build a polygon starting from points and not from x,y coord?
>
> i have a table built like this:
>
> point1 | point2 | point3 | point4 | polygon
>
> guess i have to use MakeLine and MakePolygon but i can't fugure out why...
> thanks in advance
>
> Andrea
>
_______________________________________________
> postgis-users mailing list
>postgis-users@...
>postgis.refractions.net/mailman/listinfo/postgis-users
>
>
> _______________________________________________
> postgis-users mailing list
>postgis-users@...
>postgis.refractions.net/mailman/listinfo/postgis-users
>

>

_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users



_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users

Parent Message unknown Re: build a polygon from points

by Nicklas Avén :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

ok
 
you saw my second answer?
st_makeline should work if you just define an apoint array like
array[point1, point2,point2, point1]
 
/Nicklas

2009-06-23 Caspa wrote:

yeah this could be the solution...unfortunately I have postgis version 1.3.5 and i doesn't have this feature yet..(I'm on debian system and don't want to build from source)
>
>
>>SELECT ST_MakePoly(ST_>
>LineFromMultiPoint(ST_collect(coord1, coord2, coord3, coord4, coord5, coord1 ))) from table

>this doesn't work, but I'm trying to use LineFromMultiPoint in other ways...maybe it works...
>
>THANKS
>
>SELECT ST_MakePoly(ST_>
LineFromMultiPoint(ST_collect(coord1, coord2, coord3, coord4, coord5, coord1 ))) from table
>
>

>>
2009/6/23 <nicklas.aven@...>
> >
>
About st_makeline an array is needed like this example:
>
select st_makepolygon(ST_MakeLine(array[st_point(3, 2),st_point(2, 2),st_point(3, 3),st_point(2, 5),st_point(5, 5),st_point(3, 2)]));
>
 
>
greetings
>
Nicklas>
>
 
>

>
> 2009-06-23 Caspa wrote:
>
> Hi, thanks for that,
> >those are colunm in the table :
> >
> >       coord1  |     coord2    |  coord3       |  coord4      |  pol
> > ----------------------------------------------------+--------------------
> >  geom_data | geom_data | geom_data | geom_data |  I WANT THIS
> >
> >I tried with this but didnt work;
> >
> >SELECT ST_MakePoly(ST_MakeLine(coord1, coord2, coord3, coord4, coord5, coord1 ) from table
> >
> >the problem is that I can't make i line from more than two points ( i'm using postgis v 1.3.5 and geometry ST_MakeLine(geometry[] point_array); doesn't work)
> > I'm trying to figure out how to use
> >
> >geometry ST_MakeLine(geometry set pointfield);
> >
> >but how do I build a geometry set pointfield???
> >sorry...really beginner!!
> >
> >
> >
> >
> >
> >
> >>
>
>
 
>
>
2009/6/22 Paragon Corporation <lr@...>
> >Andrea,
> > Are those individual records or columns in the table?
> >
> > Take a look at ST_MakeLine, ST_MakePolygon, ST_BuildArea
> >
> >postgis.refractions.net/documentation/manual-svn/ST_MakeLine.html
> >
> >postgis.refractions.net/documentation/manual-svn/ST_BuildArea.html
> >
> >postgis.refractions.net/documentation/manual-svn/ST_MakePolygon.html
> >
> >
> > You build a line from points with ST_MakeLine and then do a ST_BuildArea or
> > ST_MakePolygon depending on your desired effect.
> >
> > Leo
> >>
>
> >
 
> >

> >
> >
> > -----Original Message-----
> > From: postgis-users-bounces@...
> > [mailto:postgis-users-bounces@...] On Behalf Of Caspa
> > Sent: Monday, June 22, 2009 10:15 AM
> > To: postgis-users@...
> > Subject: [postgis-users] build a polygon from points
> >
> > Hi everybody,
> > I'm new to postgis...
> > how can i build a polygon starting from points and not from x,y coord?
> >
> > i have a table built like this:
> >
> > point1 | point2 | point3 | point4 | polygon
> >
> > guess i have to use MakeLine and MakePolygon but i can't fugure out why...
> > thanks in advance
> >
> > Andrea
> >
>
_______________________________________________
> > postgis-users mailing list
> >postgis-users@...
> >postgis.refractions.net/mailman/listinfo/postgis-users
> >
> >
> > _______________________________________________
> > postgis-users mailing list
> >postgis-users@...
> >postgis.refractions.net/mailman/listinfo/postgis-users
> >

> >

>_______________________________________________
> postgis-users mailing list
>postgis-users@...
>postgis.refractions.net/mailman/listinfo/postgis-users
>
>

>
_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users

Re: build a polygon from points

by Caspa :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Yes, i saw it, but in postgis 1.3.5 geometry ST_MakeLine(geometry[] point_array);  is not implemented...

gives error...

here it is


ERROR:  function makeline(geometry[]) does not exist
LINE 1: SELECT MakeLine(ARRAY[MakePoint(1,2,3),MakePoint(3,4,5), Mak...

you can check it here (just above example title)

http://postgis.refractions.net/documentation/manual-svn/ST_MakeLine.html

2009/6/23 <nicklas.aven@...>
ok
 
you saw my second answer?
st_makeline should work if you just define an apoint array like
array[point1, point2,point2, point1]
 
/Nicklas


2009-06-23 Caspa wrote:

yeah this could be the solution...unfortunately I have postgis version 1.3.5 and i doesn't have this feature yet..(I'm on debian system and don't want to build from source)
>
>
>>SELECT ST_MakePoly(ST_>
>LineFromMultiPoint(ST_collect(coord1, coord2, coord3, coord4, coord5, coord1 ))) from table

>this doesn't work, but I'm trying to use LineFromMultiPoint in other ways...maybe it works...
>
>THANKS
>
>SELECT ST_MakePoly(ST_>
LineFromMultiPoint(ST_collect(coord1, coord2, coord3, coord4, coord5, coord1 ))) from table
>
>

>>
2009/6/23 <nicklas.aven@...>
> >
>
About st_makeline an array is needed like this example:
>
select st_makepolygon(ST_MakeLine(array[st_point(3, 2),st_point(2, 2),st_point(3, 3),st_point(2, 5),st_point(5, 5),st_point(3, 2)]));
>
 
>
greetings
>
Nicklas>
>
 
>

>
> 2009-06-23 Caspa wrote:
>
> Hi, thanks for that,
> >those are colunm in the table :
> >
> >       coord1  |     coord2    |  coord3       |  coord4      |  pol
> > ----------------------------------------------------+--------------------
> >  geom_data | geom_data | geom_data | geom_data |  I WANT THIS
> >
> >I tried with this but didnt work;
> >
> >SELECT ST_MakePoly(ST_MakeLine(coord1, coord2, coord3, coord4, coord5, coord1 ) from table
> >
> >the problem is that I can't make i line from more than two points ( i'm using postgis v 1.3.5 and geometry ST_MakeLine(geometry[] point_array); doesn't work)
> > I'm trying to figure out how to use
> >
> >geometry ST_MakeLine(geometry set pointfield);
> >
> >but how do I build a geometry set pointfield???
> >sorry...really beginner!!
> >
> >
> >
> >
> >
> >
> >>
>
>
 
>
>
2009/6/22 Paragon Corporation <lr@...>
> >Andrea,
> > Are those individual records or columns in the table?
> >
> > Take a look at ST_MakeLine, ST_MakePolygon, ST_BuildArea
> >
> >postgis.refractions.net/documentation/manual-svn/ST_MakeLine.html
> >
> >postgis.refractions.net/documentation/manual-svn/ST_BuildArea.html
> >
> >postgis.refractions.net/documentation/manual-svn/ST_MakePolygon.html
> >
> >
> > You build a line from points with ST_MakeLine and then do a ST_BuildArea or
> > ST_MakePolygon depending on your desired effect.
> >
> > Leo
> >>
>
> >
 
> >

> >
> >
> > -----Original Message-----
> > From: postgis-users-bounces@...
> > [mailto:postgis-users-bounces@...] On Behalf Of Caspa
> > Sent: Monday, June 22, 2009 10:15 AM
> > To: postgis-users@...
> > Subject: [postgis-users] build a polygon from points
> >
> > Hi everybody,
> > I'm new to postgis...
> > how can i build a polygon starting from points and not from x,y coord?
> >
> > i have a table built like this:
> >
> > point1 | point2 | point3 | point4 | polygon
> >
> > guess i have to use MakeLine and MakePolygon but i can't fugure out why...
> > thanks in advance
> >
> > Andrea
> >
>
_______________________________________________
> > postgis-users mailing list
> >postgis-users@...
> >postgis.refractions.net/mailman/listinfo/postgis-users
> >
> >
> > _______________________________________________
> > postgis-users mailing list
> >postgis-users@...
> >postgis.refractions.net/mailman/listinfo/postgis-users
> >

> >

>_______________________________________________
> postgis-users mailing list
>postgis-users@...
>postgis.refractions.net/mailman/listinfo/postgis-users
>
>

>

_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users



_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users

Parent Message unknown Re: build a polygon from points

by Nicklas Avén :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

ok, I missed to check aginst 1.3.x, sorry
 
this I think is a workaroud:

select ST_PolygonFromText('POLYGON(('||st_x(p1)||' '||st_y(p1)||', '||st_x(p2)||' '||st_y(p2)||', '||st_x(p3)||' '||st_y(p3)||', '||st_x(p4)||' '||st_y(p4)||', '||st_x(p1)||' '||st_y(p1)||'))') AS aline from punkter;
 
It's ugly  but it seems to work for me at 1.3.6 and should work on 1.3.5 as well
 
/Nicklas

2009-06-23 Caspa wrote:

Yes, i saw it, but in postgis 1.3.5 geometry ST_MakeLine(geometry[] point_array);  is not implemented...
>
>gives error...
>
> here it is
>
>
>ERROR:  function makeline(geometry[]) does not exist
>LINE 1: SELECT MakeLine(ARRAY[MakePoint(1,2,3),MakePoint(3,4,5), Mak...
>
>you can check it here (just above example title)
>
>postgis.refractions.net/documentation/manual-svn/ST_MakeLine.html
>
>>
2009/6/23 <nicklas.aven@...>
> >
>
ok
>
 
>
you saw my second answer?
>
st_makeline should work if you just define an apoint array like
>
array[point1, point2,point2, point1]
>
 
>
/Nicklas>
>
 
>

>
> 2009-06-23 Caspa wrote:
>
> yeah this could be the solution...unfortunately I have postgis version 1.3.5 and i doesn't have this feature yet..(I'm on debian system and don't want to build from source)
> >
> >
> >>SELECT ST_MakePoly(ST_>
>
>
 
>
>
>LineFromMultiPoint(ST_collect(coord1, coord2, coord3, coord4, coord5, coord1 ))) from table

> >this doesn't work, but I'm trying to use LineFromMultiPoint in other ways...maybe it works...
> >
> >THANKS
> >
> >SELECT ST_MakePoly(ST_> >
LineFromMultiPoint(ST_collect(coord1, coord2, coord3, coord4, coord5, coord1 ))) from table
> >
> >

> >> >
2009/6/23 <nicklas.aven@...>
> > > >
> >
About st_makeline an array is needed like this example:
> >
select st_makepolygon(ST_MakeLine(array[st_point(3, 2),st_point(2, 2),st_point(3, 3),st_point(2, 5),st_point(5, 5),st_point(3, 2)]));
> >
 
> >
greetings
> >
Nicklas> >
> >
 
> >

> >
> > 2009-06-23 Caspa wrote:
> >
> > Hi, thanks for that,
> > >those are colunm in the table :
> > >
> > >       coord1  |     coord2    |  coord3       |  coord4      |  pol
> > > ----------------------------------------------------+--------------------
> > >  geom_data | geom_data | geom_data | geom_data |  I WANT THIS
> > >
> > >I tried with this but didnt work;
> > >
> > >SELECT ST_MakePoly(ST_MakeLine(coord1, coord2, coord3, coord4, coord5, coord1 ) from table
> > >
> > >the problem is that I can't make i line from more than two points ( i'm using postgis v 1.3.5 and geometry ST_MakeLine(geometry[] point_array); doesn't work)
> > > I'm trying to figure out how to use
> > >
> > >geometry ST_MakeLine(geometry set pointfield);
> > >
> > >but how do I build a geometry set pointfield???
> > >sorry...really beginner!!
> > >
> > >
> > >
> > >
> > >
> > >
> > >>
> >
> >
 
> >
> >
2009/6/22 Paragon Corporation <lr@...>
> > >Andrea,
> > > Are those individual records or columns in the table?
> > >
> > > Take a look at ST_MakeLine, ST_MakePolygon, ST_BuildArea
> > >
> > >postgis.refractions.net/documentation/manual-svn/ST_MakeLine.html
> > >
> > >postgis.refractions.net/documentation/manual-svn/ST_BuildArea.html
> > >
> > >postgis.refractions.net/documentation/manual-svn/ST_MakePolygon.html
> > >
> > >
> > > You build a line from points with ST_MakeLine and then do a ST_BuildArea or
> > > ST_MakePolygon depending on your desired effect.
> > >
> > > Leo
> > >>
> >
> > >
 
> > >

> > >
> > >
> > > -----Original Message-----
> > > From: postgis-users-bounces@...
> > > [mailto:postgis-users-bounces@...] On Behalf Of Caspa
> > > Sent: Monday, June 22, 2009 10:15 AM
> > > To: postgis-users@...
> > > Subject: [postgis-users] build a polygon from points
> > >
> > > Hi everybody,
> > > I'm new to postgis...
> > > how can i build a polygon starting from points and not from x,y coord?
> > >
> > > i have a table built like this:
> > >
> > > point1 | point2 | point3 | point4 | polygon
> > >
> > > guess i have to use MakeLine and MakePolygon but i can't fugure out why...
> > > thanks in advance
> > >
> > > Andrea
> > >
> >
_______________________________________________
> > > postgis-users mailing list
> > >postgis-users@...
> > >postgis.refractions.net/mailman/listinfo/postgis-users
> > >
> > >
> > > _______________________________________________
> > > postgis-users mailing list
> > >postgis-users@...
> > >postgis.refractions.net/mailman/listinfo/postgis-users
> > >

> > >

> >_______________________________________________
> > postgis-users mailing list
> >postgis-users@...
> >postgis.refractions.net/mailman/listinfo/postgis-users
> >
> >

> >

>_______________________________________________
> postgis-users mailing list
>postgis-users@...
>postgis.refractions.net/mailman/listinfo/postgis-users
>
>

>
_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users

Parent Message unknown Re: build a polygon from points

by Nicklas Avén :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

of course not as aline, but as apolygon
/Nicklas
 
select ST_PolygonFromText('POLYGON(('||st_x(p1)||' '||st_y(p1)||', '||st_x(p2)||' '||st_y(p2)||', '||st_x(p3)||' '||st_y(p3)||', '||st_x(p4)||' '||st_y(p4)||', '||st_x(p1)||' '||st_y(p1)||'))') AS apolygon from pointTable

2009-06-23 nicklas.aven@... wrote:

>
ok, I missed to check aginst 1.3.x, sorry
>
 
>
this I think is a workaroud:
>

> select ST_PolygonFromText('POLYGON(('||st_x(p1)||' '||st_y(p1)||', '||st_x(p2)||' '||st_y(p2)||', '||st_x(p3)||' '||st_y(p3)||', '||st_x(p4)||' '||st_y(p4)||', '||st_x(p1)||' '||st_y(p1)||'))') AS aline from punkter;
>
 
>
It's ugly  but it seems to work for me at 1.3.6 and should work on 1.3.5 as well
>
 
>
/Nicklas
>
> 2009-06-23 Caspa wrote:
>
> Yes, i saw it, but in postgis 1.3.5 geometry ST_MakeLine(geometry[] point_array);  is not implemented...
> >
> >gives error...
> >
> > here it is
> >
> >
> >ERROR:  function makeline(geometry[]) does not exist
> >LINE 1: SELECT MakeLine(ARRAY[MakePoint(1,2,3),MakePoint(3,4,5), Mak...
> >
> >you can check it here (just above example title)
> >
> >postgis.refractions.net/documentation/manual-svn/ST_MakeLine.html
> >
> >>
>
2009/6/23 <nicklas.aven@...>
> > >
>
> >
ok
> >
 
> >
you saw my second answer?
> >
st_makeline should work if you just define an apoint array like
> >
array[point1, point2,point2, point1]
> >
 
> >
/Nicklas> >
> >
 
> >

> >
> > 2009-06-23 Caspa wrote:
> >
> > yeah this could be the solution...unfortunately I have postgis version 1.3.5 and i doesn't have this feature yet..(I'm on debian system and don't want to build from source)
> > >
> > >
> > >>SELECT ST_MakePoly(ST_>
> >
> >
 
> >
> >
>LineFromMultiPoint(ST_collect(coord1, coord2, coord3, coord4, coord5, coord1 ))) from table

> > >this doesn't work, but I'm trying to use LineFromMultiPoint in other ways...maybe it works...
> > >
> > >THANKS
> > >
> > >SELECT ST_MakePoly(ST_> > >
LineFromMultiPoint(ST_collect(coord1, coord2, coord3, coord4, coord5, coord1 ))) from table
> > >
> > >

> > >> > >
2009/6/23 <nicklas.aven@...>
> > > > > >
> > >
About st_makeline an array is needed like this example:
> > >
select st_makepolygon(ST_MakeLine(array[st_point(3, 2),st_point(2, 2),st_point(3, 3),st_point(2, 5),st_point(5, 5),st_point(3, 2)]));
> > >
 
> > >
greetings
> > >
Nicklas> > >
> > >
 
> > >

> > >
> > > 2009-06-23 Caspa wrote:
> > >
> > > Hi, thanks for that,
> > > >those are colunm in the table :
> > > >
> > > >       coord1  |     coord2    |  coord3       |  coord4      |  pol
> > > > ----------------------------------------------------+--------------------
> > > >  geom_data | geom_data | geom_data | geom_data |  I WANT THIS
> > > >
> > > >I tried with this but didnt work;
> > > >
> > > >SELECT ST_MakePoly(ST_MakeLine(coord1, coord2, coord3, coord4, coord5, coord1 ) from table
> > > >
> > > >the problem is that I can't make i line from more than two points ( i'm using postgis v 1.3.5 and geometry ST_MakeLine(geometry[] point_array); doesn't work)
> > > > I'm trying to figure out how to use
> > > >
> > > >geometry ST_MakeLine(geometry set pointfield);
> > > >
> > > >but how do I build a geometry set pointfield???
> > > >sorry...really beginner!!
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >>
> > >
> > >
 
> > >
> > >
2009/6/22 Paragon Corporation <lr@...>
> > > >Andrea,
> > > > Are those individual records or columns in the table?
> > > >
> > > > Take a look at ST_MakeLine, ST_MakePolygon, ST_BuildArea
> > > >
> > > >postgis.refractions.net/documentation/manual-svn/ST_MakeLine.html
> > > >
> > > >postgis.refractions.net/documentation/manual-svn/ST_BuildArea.html
> > > >
> > > >postgis.refractions.net/documentation/manual-svn/ST_MakePolygon.html
> > > >
> > > >
> > > > You build a line from points with ST_MakeLine and then do a ST_BuildArea or
> > > > ST_MakePolygon depending on your desired effect.
> > > >
> > > > Leo
> > > >>
> > >
> > > >
 
> > > >

> > > >
> > > >
> > > > -----Original Message-----
> > > > From: postgis-users-bounces@...
> > > > [mailto:postgis-users-bounces@...] On Behalf Of Caspa
> > > > Sent: Monday, June 22, 2009 10:15 AM
> > > > To: postgis-users@...
> > > > Subject: [postgis-users] build a polygon from points
> > > >
> > > > Hi everybody,
> > > > I'm new to postgis...
> > > > how can i build a polygon starting from points and not from x,y coord?
> > > >
> > > > i have a table built like this:
> > > >
> > > > point1 | point2 | point3 | point4 | polygon
> > > >
> > > > guess i have to use MakeLine and MakePolygon but i can't fugure out why...
> > > > thanks in advance
> > > >
> > > > Andrea
> > > >
> > >
_______________________________________________
> > > > postgis-users mailing list
> > > >postgis-users@...
> > > >postgis.refractions.net/mailman/listinfo/postgis-users
> > > >
> > > >
> > > > _______________________________________________
> > > > postgis-users mailing list
> > > >postgis-users@...
> > > >postgis.refractions.net/mailman/listinfo/postgis-users
> > > >

> > > >

> > >_______________________________________________
> > > postgis-users mailing list
> > >postgis-users@...
> > >postgis.refractions.net/mailman/listinfo/postgis-users
> > >
> > >

> > >
>

> >_______________________________________________
> > postgis-users mailing list
> >postgis-users@...
> >postgis.refractions.net/mailman/listinfo/postgis-users
> >
> >

> >
_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users