[postgis-users] point to list

Paragon Corporation lr at pcorp.us
Sun Oct 11 07:57:39 PDT 2009


 that should have been <= ST_NPoints(..) 

-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Paragon
Corporation
Sent: Sunday, October 11, 2009 10:38 AM
To: 'PostGIS Users Discussion'
Subject: Re: [postgis-users] point to list

Try
 
SELECT n As id, ST_PointN(ST_Boundary(the_geom),n) As the_geom FROM (SELECT
ST_GeomFromText('POLYGON ((0 0, 0 1, 1 1, 1 0, 0 0))' ) as
the_geom) As foo
CROSS JOIN generate_series(1, 10000) As n WHERE n  < ST_NPoints(the_geom)

1) The above will only work with POLYGONS that don't have holes.  If you
have holes then you have to decide how you will store the id for the holes.
Also if you have polygons, you'll need to dump them first.
2) you need to set 10000 to a number greater than the number of points you
have in any particular polyon.  so to figure that out
3) The foo subquery you can replace with any table

SELECT MAX(ST_NPoints(the_geom))
FROM yourtable

Leo

________________________________

From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of eehab
hamzeh
Sent: Sunday, October 11, 2009 8:13 AM
To: postgis-users at postgis.refractions.net
Subject: [postgis-users] point to list


Hello 
 
i try to have the points that make one polygon in one table as follow.
 
i have the following polygon
 
polygon (0 0, 0 1, 1 1, 1 0)
 
i need it to be in a table where the results looks like 
 
id :  the_geom
1  :  point(0 0)
2  :  point(0,1)
3  :  point(1 1)
4  :  point(1,0)
 
i try to use st_dump(the geom) from polygon
 
it does not work
it is important to me to assign id for each point
 
 
thanks 
 


________________________________

Windows Live: Friends get your Flickr, Yelp, and Digg updates when they
e-mail you.
<http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/so
cial-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_3:092010
>  


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






More information about the postgis-users mailing list