<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>

<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7226.0">
<TITLE>Re: [postgis-users] Why doesn't startpoint work? (and X() for that matter)</TITLE>
</HEAD>
<BODY>
<DIV id=idOWAReplyText95560 dir=ltr>
<DIV dir=ltr><FONT face=Arial color=#000000 size=2>Ok got it. I think the 
documentation should be changed from "find an return the X coordinate of the 
first point in the geometry" to "...first point in a linestring"</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2></FONT> </DIV>
<DIV dir=ltr><FONT face=Arial size=2>-e</FONT></DIV></DIV>
<DIV dir=ltr><BR>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> strk@refractions.net 
[mailto:strk@refractions.net]<BR><B>Sent:</B> Tue 12/28/2004 2:16 
AM<BR><B>To:</B> Ethan Alpert<BR><B>Cc:</B> PostGIS Users 
Discussion<BR><B>Subject:</B> Re: [postgis-users] Why doesn't startpoint work? 
(and X() for that matter)<BR></FONT><BR></DIV>
<DIV>
<P><FONT size=2>On Mon, Dec 27, 2004 at 05:14:51PM -0700, Ethan Alpert 
wrote:<BR>><BR>><BR>> >From the docs:<BR>><BR>> 
X(geometry)<BR>> Find and return the X coordinate of the first point in the 
geometry.<BR>> Return NULL if there is no point in the 
geometry.<BR>><BR>> StartPoint(geometry)<BR>> Returns the first point 
of the geometry as a point.<BR>><BR>> spatialdb=> select 
startpoint(the_geom),X(the_geom),the_geom from snaps<BR>> where catalogid 
='101001000379CE01';<BR>> -[ RECORD 1]<BR>> startpoint |<BR>> 
x          |<BR>> 
the_geom   | SRID=4326;POLYGON((73.2565444444444<BR>> 
45.141725,73.4717277777778 45.1421555555556,73.4707527777778<BR>> 
44.9756666666667,73.257175 44.975625,73.2565444444444 
45.141725))<BR>><BR>> So what gives?! Why do these return NULL? Is there a 
better reference<BR>> doc somewhere?<BR><BR>These are OGC functions. 
StartPoint/EndPoint should only work with<BR>LineString inputs (postgis actually 
extends this looking for the<BR>first LineString in a complex geometry, but that 
'extension' should<BR>probably be dropped for OGC *strictness*). X/Y/Z/M should 
only<BR>work with Point geometries.<BR><BR>Your query should be:<BR><BR>=> 
SELECT StartPoint(OuterRing(the_geom)), 
X(StartPoint(OuterRing(the_geom)))<BR>   FROM snaps WHERE catalogid = 
'101001000379CE01';<BR><BR>> While we're on the subject how can I convert 
between geometry types? I'd<BR>> like to turn some polygons into 
lines.<BR><BR>There is no function available for this. You should script 
it<BR>with calls to ExteriorRing(), NumInteriorRing() and 
InteriorRingN().<BR><BR>--strk;<BR><BR>><BR>> -e<BR>> 
_______________________________________________<BR>> postgis-users mailing 
list<BR>> postgis-users@postgis.refractions.net<BR>> <A 
href="http://postgis.refractions.net/mailman/listinfo/postgis-users">http://postgis.refractions.net/mailman/listinfo/postgis-users</A><BR></FONT></P></DIV>

</BODY>
</HTML>