Opened 7 years ago
Closed 7 years ago
#6894 closed defect (fixed)
Python GDAL bindings return a non zero area when GetArea() is called on a linestring (which is not a ring)
Reported by: | gcfrane | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | default | Version: | 2.1.0 |
Severity: | normal | Keywords: | |
Cc: |
Description
The bug report references GDAL python bindings and possibly GDAL itself (because I presume GDAL does the actual calculation).
The following code returns different results in different GDAL versions:
Code highlighting:
from osgeo import ogr, gdal from osgeo import osr print "Version: %s" % gdal.VersionInfo() wkt = "LINESTRING (-82.7586364746092 40.2774302714686," \ "-82.7407836914061 40.2920966956315," \ "-82.7133178710935 40.2920966956315," \ "-82.6446533203123 40.3423574175141," \ "-82.6199340820311 40.3496839800263," \ "-82.5732421874998 40.3475907576573," \ "-82.5471496582029 40.3528236917686," \ "-82.5155639648435 40.3664274201412," \ "-82.5059509277342 40.3800284034428," \ "-82.5100708007811 40.394672546054," \ "-82.4880981445311 40.3967643065031)" line = ogr.CreateGeometryFromWkt(wkt) print "Area: %f" % line.GetArea()
------------------------ Version: 2010000 Area: 0.000293 ------------------------ Version: 1110500 Area: 0.000000 ------------------------
Expected area response for a line is 0.
Note:
See TracTickets
for help on using tickets.
In 38473: