[postgis-users] Using X(geometry) and equivalents

strk at refractions.net strk at refractions.net
Thu Sep 15 07:55:40 PDT 2005


Guido, thanks for the report. I've fixed the manual page.
To extract first point of a POLYGON you can use:

	SELECT PointN(ExteriorRing(polygon), 1)

--strk;

On Thu, Sep 15, 2005 at 04:38:29PM +0200, Guido Lemoine wrote:
> Dear All,
> 
> Just another one of these small clarification questions.
> 
> The postgis manual says:
> 
> X(geometry) Find and return the X coordinate of the first point in the 
> geometry. Return NULL if there is no point in the geometry.
> 
> (and similar for the Y, Z equivalants)
> 
> I understood this to work on any geometry (e.g. LINESTRING, POLYGON), 
> but this is not true. It only works on POINT geometry.
> The first sentence is somewhat misleading therefore. And the last should 
> probably say "Return NULL if geometry is not a POINT".
> 
> I was trying to get the X coordinate of the first point of a POLYGON. 
> This is not as easy as for a LINESTRING
> (using x(pointN(linestring, 1)). In fact, I'd be interesting to know how 
> to do that. Is there a reverse version of
> MakePolygon?
> 
> Keep up the good work,
> 
> Guido Lemoine
> 
> 
> 
> _______________________________________________
> 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