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

Guido Lemoine guido.lemoine at jrc.it
Thu Sep 15 07:38:29 PDT 2005


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






More information about the postgis-users mailing list