<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>&nbsp;</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>&gt;<BR>&gt;<BR>&gt; &gt;From the docs:<BR>&gt;<BR>&gt; 
X(geometry)<BR>&gt; Find and return the X coordinate of the first point in the 
geometry.<BR>&gt; Return NULL if there is no point in the 
geometry.<BR>&gt;<BR>&gt; StartPoint(geometry)<BR>&gt; Returns the first point 
of the geometry as a point.<BR>&gt;<BR>&gt; spatialdb=&gt; select 
startpoint(the_geom),X(the_geom),the_geom from snaps<BR>&gt; where catalogid 
='101001000379CE01';<BR>&gt; -[ RECORD 1]<BR>&gt; startpoint |<BR>&gt; 
x&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |<BR>&gt; 
the_geom&nbsp;&nbsp; | SRID=4326;POLYGON((73.2565444444444<BR>&gt; 
45.141725,73.4717277777778 45.1421555555556,73.4707527777778<BR>&gt; 
44.9756666666667,73.257175 44.975625,73.2565444444444 
45.141725))<BR>&gt;<BR>&gt; So what gives?! Why do these return NULL? Is there a 
better reference<BR>&gt; 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>=&gt; 
SELECT StartPoint(OuterRing(the_geom)), 
X(StartPoint(OuterRing(the_geom)))<BR>&nbsp;&nbsp; FROM snaps WHERE catalogid = 
'101001000379CE01';<BR><BR>&gt; While we're on the subject how can I convert 
between geometry types? I'd<BR>&gt; 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>&gt;<BR>&gt; -e<BR>&gt; 
_______________________________________________<BR>&gt; postgis-users mailing 
list<BR>&gt; postgis-users@postgis.refractions.net<BR>&gt; <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>