[postgis-users] ST_NumPoints

Fred Lehodey lehodey at gmail.com
Thu May 21 02:19:45 PDT 2009


Hi,
try ST_npoints(geometry)
(ST_NumPoints(geometria) is only for linestring)


Fred




2009/5/21 Kis János Tamás <kijato at gmail.com>

> Hi,
>
> I have a big table (with 21000 rows):
>
> CREATE TABLE kecskemet_k.foldreszletek
> ( sorszam bigserial NOT NULL,
>  hrsz text,
>  geometria geometry --POLYGON
> ) WITH (OIDS=TRUE);
> CREATE INDEX i_foldreszletek_geometria ON kecskemet_k.foldreszletek
> USING gist (geometria);
>
> I'd like to know, how many point exists each geometry.
>
> When I use the next SQL:
>
> SELECT hrsz, round(ST_Area(geometria)), ST_NumPoints(geometria),
>              CASE WHEN ST_NumPoints(geometria) IS NULL THEN '-' ELSE
> else '+' END
> FROM kecskemet_k.foldreszletek
> ORDER BY 2 DESC
> LIMIT 10;
>
> the result is:
>   hrsz    | round | st_numpoints | case
> -----------+-------+--------------+------
>  0118/4    |  2913 |              | -
>  01521/172 | 21738 |              | -
>  0183/27   |  2877 |              | -
>  0855/53   |  5169 |              | -
>  0413/43   |  1025 |              | -
>  094/65    |  3130 |              | -
>  0747/2    |  2877 |              | -
>  01183/4   |   326 |              | -
>  01609/79  |  2737 |              | -
>  0801/163  |  1924 |              | -
> (10 rows)
>
> Why I got NULL value in the st_numpoints?
>
> thx,
> kjt
> _______________________________________________
> 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/20090521/ca446c4a/attachment.html>


More information about the postgis-users mailing list