Opened 12 years ago

Closed 12 years ago

#2067 closed defect (duplicate)

Invalid polygons give empty centroids

Reported by: sderle Owned by: pramsey
Priority: medium Milestone: PostGIS 1.5.6
Component: postgis Version: 1.5.X
Keywords: Cc:

Description

# select astext(way) from planet_osm_polygon where st_geometrytype(st_centroid(way)) <> 'ST_Point';

astext
---------------------------------------------------
 POLYGON((-73.042747 40.961426,-73.042571 40.961971,-73.042747
 40.961426,-73.0426927 40.9610055,-73.0426645 40.960956,-73.0426927
 40.9610055,-73.042747 40.961426))
 POLYGON((-73.042747 40.961426,-73.042571 40.961971,-73.042747
 40.961426,-73.0426927 40.9610055,-73.0426645 40.960956,-73.0426927
 40.9610055,-73.042747 40.961426))
 POLYGON((-65.912493 18.220862,-65.911621 18.220036,-65.911401
 18.219793,-65.910957 18.21916,-65.910925 18.219101,-65.910668
 18.218553,-65.910398 18.217805,-65.910024 18.216882,-65.90946
 18.215632,-65.909338 18.215362,-65.908986 18.21459,-65.908951
 18.214513,-65.908844 18.214279,-65.90866 18.213946,-65.908404
 18.213684,-65.908044 18.213497,-65.907776 18.213446,-65.907033
 18.213408,-65.906508 18.213338,-65.906074 18.213238,-65.905838
 18.213183,-65.906074 18.213238,-65.906508 18.213338,-65.907033
 18.213408,-65.907776 18.213446,-65.908044 18.213497,-65.908404
 18.213684,-65.90866 18.213946,-65.908844 18.214279,-65.908951
 18.214513,-65.908986 18.21459,-65.909338 18.215362,-65.90946
 18.215632,-65.910024 18.216882,-65.910398 18.217805,-65.910668
 18.218553,-65.910925 18.219101,-65.910957 18.21916,-65.911401
 18.219793,-65.911621 18.220036,-65.912493 18.220862))
(3 rows)

# select st_isvalid(way) from planet_osm_polygon where st_geometrytype(st_centroid(way)) <> 'ST_Point';                                

NOTICE:  Self-intersection at or near point -73.042747000000006 40.961426000000003
NOTICE:  Self-intersection at or near point -73.042747000000006 40.961426000000003
NOTICE:  Self-intersection at or near point -65.912492999999998 18.220862

st_isvalid 
------------
f
f
f
(3 rows)

# select astext(st_centroid(way)) from planet_osm_polygon where st_geometrytype(st_centroid(way)) <> 'ST_Point';

          astext          
--------------------------
 GEOMETRYCOLLECTION EMPTY
 GEOMETRYCOLLECTION EMPTY
 GEOMETRYCOLLECTION EMPTY
(3 rows)

# select postgis_version();
            postgis_version            
--------------------------------------- 
1.5 USE_GEOS=1 USE_PROJ=1 USE_STATS=1
(1 row)

There are over 2,000 other geometries in this table for which ST_IsValid() fails, but which still produce centroids of type ST_Point.

System is Ubuntu 11.10 with stock GEOS 3.3.3 installed.

Change History (1)

comment:1 by sderle, 12 years ago

Resolution: duplicate
Status: newclosed
Note: See TracTickets for help on using tickets.