[PATCH - Shapelib] Shapefile driver can write wrong winding order for some polygons with small area but big coordinates
|Reported by:||Even Rouault||Owned by:||warmerdam|
Frank, this is an issue strictly identical to #3356, but in shpopen.c. The code to detect the winding order used a variant of Green Formula which would return 0 for polygons with small area but big coordinates.
The issue can be seen when enabling the new ogr_shape_34 test I've commited in r18675.
Attached a fix that uses a more stable variant of Green Formula. Another possibility would have been to adapt the new implementation of OGRLinearRing::isClockWise() (which turns to be the old used in the read part of the shapefile driver of older GDAL), but this requires more coding.