[postgis-users] ST_NPoints from polygons

Martin Davis mtnclimb at gmail.com
Mon Jul 1 08:24:32 PDT 2019

Yes, that is correct.

As per the Simple Features for SQL standard, Linear Rings include a closing
point which is equal to the start point, and all points are included in the
count.  Polygons are made up of rings, so inherit this behaviour.

On Mon, Jul 1, 2019, 4:46 AM Etienne B. Racine <etiennebr at gmail.com> wrote:

> Hi list,
> I'm implementing postgis compatible functions for R, so I wanted to make
> sure I had the right behavior. I wanted to check that the behavior of
> ST_NPoints was consistent with expectations.
> SELECT ST_NPoints('POLYGON((0 0, 1 1, 2 0, 0 0))'::geometry);
> #>  st_npoints
> #> ------------
> #>           4
> I would have expected that the repeated vertex wouldn't be counted (a
> triangle would have 3 vertices). The doc (*Return the number of points in
> a geometry*) seems to imply that the behavior is correct though, since a
> point isn't necessarly a vertex; but it still leaves room to interpretation.
> Etienne
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/postgis-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20190701/757ec741/attachment.html>

More information about the postgis-users mailing list