[postgis-users] SQL query

Maxime van Noppen maxime at altribe.org
Fri Jul 1 09:03:31 PDT 2011


On 07/01/2011 05:58 PM, Brian Sanjeewa Rupasinghe wrote:
> Hi,
>
> I am using following SQL query to retrieve the coordinates of the first
> vertex of the first multipolygon in the
> table Building_Poly.
>
> select X(pointN(ExteriorRing(GeometryN(the_geom,1)),*1*)),
> Y(pointN(ExteriorRing(GeometryN(the_geom,1)),*1*)) from
> building_poly limit 1;
>
> In order to get the other coordinates of the vertices of the polygon, i
> want to find out the number of vertices of the
> multipolygon and then iterate through. How to do this using a loop?

Hi,

You probably want to use ST_DumpPoints :

   http://postgis.refractions.net/docs/ST_DumpPoints.html

-- 
Maxime



More information about the postgis-users mailing list