id summary reporter owner description type status priority milestone component version severity resolution keywords cc 1673 OGR_G_CloseRings side-effect on OGR_G_GetGeometryType jbronn Mateusz Łoskot "After closing the rings on a Polygon, when attempting to get the geometry type of one of the closed rings, OGR returns a nonsense number. Exporting the closed-ring Polygon to WKT fixes this scenario, and the closed ring will subsequently return the correct geometry type. Here is a Python script that demonstrates the problem: {{{ #!python import ogr # Unclosed Polygon WKT wkt = 'POLYGON((0 0, 5 0, 5 5, 0 5), (1 1, 2 1, 2 2, 2 1))' if __name__=='__main__': # Creating the polygon from the WKT poly = ogr.CreateGeometryFromWkt(wkt) # Getting the exterior ring before we close all rings ring_b = poly.GetGeometryRef(0) print 'Ring Geometry Type Before Closure: %d' % ring_b.GetGeometryType() # Closing the rings poly.CloseRings() # Now getting the same ring again ring_a = poly.GetGeometryRef(0) print 'Ring Geometry Type After Closure: %d' % ring_a.GetGeometryType() # Exporting closed Polygon to WKT ""fixes"" this. ring_wkt = str(poly) ring_a = poly.GetGeometryRef(0) print 'Ring Geometry Type Fixed: %d' % ring_a.GetGeometryType() }}} Here is the output from that script: {{{ Ring Geometry Type Before Closure: 2 Ring Geometry Type After Closure: -2147483646 Ring Geometry Type Fixed: 2 }}} " defect closed low 1.4.2 OGR_SF 1.4.1 normal fixed geometry jbronn@… warmerdam