[postgis-users] Why doesn't startpoint work? (and X() for that matter)

strk at refractions.net strk at refractions.net
Tue Dec 28 06:11:32 PST 2004


On Tue, Dec 28, 2004 at 06:37:30AM -0700, Ethan Alpert wrote:
> 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"

Done already, thanks.
I'm sure there are other cases, and also postgis seeks the first LineString
(or Point of Polygon) in a collection for OGC methods application, which
should probably be dropped as a feature (for OGC strictness).

--strk;

>  
> -e
> 
> ________________________________
> 
> From: strk at refractions.net [mailto:strk at refractions.net]
> Sent: Tue 12/28/2004 2:16 AM
> To: Ethan Alpert
> Cc: PostGIS Users Discussion
> Subject: Re: [postgis-users] Why doesn't startpoint work? (and X() for that matter)
> 
> 
> 
> On Mon, Dec 27, 2004 at 05:14:51PM -0700, Ethan Alpert wrote:
> >
> >
> > >From the docs:
> >
> > 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.
> >
> > StartPoint(geometry)
> > Returns the first point of the geometry as a point.
> >
> > spatialdb=> select startpoint(the_geom),X(the_geom),the_geom from snaps
> > where catalogid ='101001000379CE01';
> > -[ RECORD 1]
> > startpoint |
> > x          |
> > the_geom   | SRID=4326;POLYGON((73.2565444444444
> > 45.141725,73.4717277777778 45.1421555555556,73.4707527777778
> > 44.9756666666667,73.257175 44.975625,73.2565444444444 45.141725))
> >
> > So what gives?! Why do these return NULL? Is there a better reference
> > doc somewhere?
> 
> These are OGC functions. StartPoint/EndPoint should only work with
> LineString inputs (postgis actually extends this looking for the
> first LineString in a complex geometry, but that 'extension' should
> probably be dropped for OGC *strictness*). X/Y/Z/M should only
> work with Point geometries.
> 
> Your query should be:
> 
> => SELECT StartPoint(OuterRing(the_geom)), X(StartPoint(OuterRing(the_geom)))
>    FROM snaps WHERE catalogid = '101001000379CE01';
> 
> > While we're on the subject how can I convert between geometry types? I'd
> > like to turn some polygons into lines.
> 
> There is no function available for this. You should script it
> with calls to ExteriorRing(), NumInteriorRing() and InteriorRingN().
> 
> --strk;
> 
> >
> > -e
> > _______________________________________________
> > postgis-users mailing list
> > postgis-users at postgis.refractions.net
> > http://postgis.refractions.net/mailman/listinfo/postgis-users
> 
> 

-- 

For standing up against patentability of software,

  Thank You, Poland!

Read the intervention:    http://kwiki.ffii.org/ConsPolon041221En
Send your thanks:         thankyoupoland.info
Read/do more:		  http://www.noepatents.org/



More information about the postgis-users mailing list