[postgis-users] how many vertices in a linestring

Maxime van Noppen maxime at altribe.org
Fri Nov 20 07:48:43 PST 2009


Marco Lechner - FOSSGIS e.V. wrote:
> is there a function that returns the number of points of a geometry?
> 
> LINESTRING(9.6567389 47.8442843,9.6572511 47.8443736,9.6570058
> 47.8449885,9.6565007 47.8449207,9.6567378 47.8442853) => 5
> LINESTRING(8.9289313 48.6910326,8.9289313 48.6910326) => 2
> ...

Hi,

You might want to look at ST_NPoints and ST_Numpoints for linestrings :

http://postgis.refractions.net/documentation/manual-1.4/ST_NumPoints.html
http://postgis.refractions.net/documentation/manual-1.4/ST_NPoints.html

However for geometries in general it's more complicated.

-- 
Maxime



More information about the postgis-users mailing list