[postgis-users] distance between two end points of a line
Shane Spencer
shane at bogomip.com
Tue Sep 18 08:31:06 PDT 2007
Just dinking around.
select distance(
startpoint(GeomFromText('LINESTRING( 0 0, 1 1 )')),
endpoint(GeomFromText('LINESTRING( 0 0, 1 1 )'))
);
distance
-----------------
1.4142135623731
confirmed via python CLI
>>> math.sqrt(1 + 1)
1.4142135623730951
make sure your geometries are LINESTRING, otherwise this may not work out
all that well for you.
On 9/18/07, temiz <temiz at deprem.gov.tr> wrote:
>
> hello
>
> I want to calculate distance between two end points of a line
>
> I used:
> select cat,
>
> distance(pointn(wkb_geometry,1),pointn(wkb_geometry,npoints(wkb_geometry)))
> from spelhey;
>
> it gives all zero
>
> cat | distance
> -----+----------
> 1 | 0
> 2 | 0
> 3 | 0
> 4 | 0
> 5 | 0
> 6 | 0
> 7 | 0
> 8 | 0
> 9 | 0
> 10 | 0
> 11 | 0
> 12 | 0
> 13 | 0
> 14 | 0
> 15 | 0
> 16 | 0
> 17 | 0
> 17 | 0
>
> can you tell me what happened ?
>
> regards
>
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20070918/c519e58f/attachment.html>
More information about the postgis-users
mailing list