[postgis-users] Postgis for dummies

Kevin Neufeld kneufeld at refractions.net
Fri Nov 6 21:04:10 PST 2009


The best way?  Unfortunately, at this point in time, I'm afraid so.  
We've had this on our wish list for some time now 
(http://trac.osgeo.org/postgis/ticket/76).  If you want, you can import 
a plpgsql implementation of this until it's implemented in C 
(http://trac.osgeo.org/postgis/attachment/ticket/76/my_st_dump_points.2.sql). 


Usage would be something like:
SELECT ST_AsText( (ST_DumpPoints( poly )).geom )
FROM (
   SELECT 'POLYGON((0 0, 1 1, 1 0, 0 0))'::geometry AS poly
) AS foo;

 st_astext 
------------
 POINT(0 0)
 POINT(1 1)
 POINT(1 0)
 POINT(0 0)
(4 rows)

Cheers,
Kevin

Fernando Tong wrote:
> it works,  thank you very much. However, i wonder if this is the best 
> way (:
>
> On Fri, Nov 6, 2009 at 1:26 PM, Moen, Paul T. <pmoen at nd.gov 
> <mailto:pmoen at nd.gov>> wrote:
>
>
>     SELECT DISTINCT ST_X(ST_POINTN(foo.lines,foo.index)) AS
>     x,ST_Y(ST_POINTN(foo.lines,foo.index)) AS y FROM 
>     (select thelines.lines,generate_series(1,thelines.n) AS index FROM 
>     (select polys.geo AS lines, ST_NUMPOINTS(polys.geo) AS n FROM 
>     (SELECT ST_BOUNDARY((ST_DUMP(the_geom)).geom) AS geo FROM
>     "YOURTABLE" WHERE YOURQUERY) AS polys) 
>     AS thelines) 
>     AS foo;
>
>
>     should work for multipolygons and polygons.although there may be
>     an easier way.
>
>
>     Paul Moen
>
>
>     On Nov 6, 2009, at 12:03 PM, Fernando Tong wrote:
>
>>     I have a dummy question:
>>
>>     i have a POLYGON, how can i get all the polygon's coordinates
>>     with a SELECT query?
>>
>>     something like: 
>>     select unknown_functions(polygon) from mytable
>>
>>     output:
>>     1 POINT(1 2) 
>>     2 POINT(2 2)
>>     3 POINT(3 2)
>>     ...
>>
>>     or much better if i get
>>         X    Y
>>     1  1     2
>>     2  2     2
>>     3  3     2
>>
>>     Thanks a lot.
>>
>>
>>     On Fri, Nov 6, 2009 at 9:19 AM, David Fawcett
>>     <david.fawcett at gmail.com <mailto:david.fawcett at gmail.com>> wrote:
>>
>>         I think that another good way to approach it is to have a
>>         task/problem
>>         that you want to solve using PostGIS (whether real or made
>>         up).  Learn
>>         what you need to about PostGIS to solve that problem and
>>         branch out
>>         from there.
>>
>>         David.
>>
>>         On Fri, Nov 6, 2009 at 12:04 AM, Paragon Corporation
>>         <lr at pcorp.us <mailto:lr at pcorp.us>> wrote:
>>         > You can also look at some of these - might be helpful
>>         >
>>         >
>>         http://www.bostongis.com/PrinterFriendly.aspx?content_name=postgis_tut01
>>         >
>>         > http://workshops.opengeo.org/stack-intro/
>>         >
>>         > This one is a bit dated but probably still useful
>>         > http://2007.foss4g.org/workshops/W-04/
>>         >
>>         > Leo
>>         > ________________________________
>>         > From: postgis-users-bounces at postgis.refractions.net
>>         <mailto:postgis-users-bounces at postgis.refractions.net>
>>         > [mailto:postgis-users-bounces at postgis.refractions.net
>>         <mailto:postgis-users-bounces at postgis.refractions.net>] On
>>         Behalf Of Bob and
>>         > Deb
>>         > Sent: Thursday, November 05, 2009 11:51 PM
>>         > To: PostGIS Users Discussion
>>         > Subject: Re: [postgis-users] Postgis for dummies
>>         >
>>         > How about the book, "PostGIS in Action" ?   There is even a
>>         free chapter
>>         > that might give you enough info to get started.  There is
>>         also the Wiki.
>>         >
>>         > -Bob
>>         >
>>         > On Thu, Nov 5, 2009 at 6:34 PM, Jeff Matthews
>>         <info at sovereignstates.net <mailto:info at sovereignstates.net>>
>>         > wrote:
>>         >>
>>         >> Need link to tutorial at the “dummy” level.
>>         >>
>>         >>
>>         >>
>>         >> I know a bit about kml, but that’s it.  In looking at
>>         postgis, I now see,
>>         >> in the instructions, things like, “To spatially-enable a
>>         jump-oriented
>>         >> static sql line pointer,….”   That’s just wayyyy over me. 
>>         Where do I go as
>>         >> I newbie in gis to become a pro like you all?
>>         >>
>>         >>
>>         >>
>>         >> Thanks.
>>         >>
>>         >> _______________________________________________
>>         >> postgis-users mailing list
>>         >> postgis-users at postgis.refractions.net
>>         <mailto:postgis-users at postgis.refractions.net>
>>         >> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>         >>
>>         >
>>         >
>>         > _______________________________________________
>>         > postgis-users mailing list
>>         > postgis-users at postgis.refractions.net
>>         <mailto:postgis-users at postgis.refractions.net>
>>         > http://postgis.refractions.net/mailman/listinfo/postgis-users
>>         >
>>         >
>>         _______________________________________________
>>         postgis-users mailing list
>>         postgis-users at postgis.refractions.net
>>         <mailto:postgis-users at postgis.refractions.net>
>>         http://postgis.refractions.net/mailman/listinfo/postgis-users
>>
>>
>>     _______________________________________________
>>     postgis-users mailing list
>>     postgis-users at postgis.refractions.net
>>     <mailto:postgis-users at postgis.refractions.net>
>>     http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>
>     _______________________________________________
>     postgis-users mailing list
>     postgis-users at postgis.refractions.net
>     <mailto:postgis-users at postgis.refractions.net>
>     http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> 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