Gaspare Sganga

IT Manager, GIS Analyst & Lead Developer @setin.

Freelance Developer & Consultant.

Buy me a coffee?

What’s new in Version 2.4.2

  • Reversed the orientation of inner and outer rings in GeoJSON output of Polygons and MultiPolygons

Reversed the orientation of inner and outer rings in GeoJSON output of Polygons and MultiPolygons

Thanks to a GitHub ticket I noted section 3.1.6 of RFC 7946 states:

A linear ring MUST follow the right-hand rule with respect to the
area it bounds, i.e., exterior rings are counterclockwise, and
holes are clockwise.

This creates a conflict with the ESRI Shapefile format, which stores inner and outer rings with opposite orientation.
I won’t digress here into the advisability of such a choice for the which goes against well-established de facto standards without a real reason to do so. If you really want to know my opinion, please read my answer to that ticket.

Long story short, PHP ShapeFile will silently reverse the orientation of the points only in GeoJSON output, so it is now compliant (I hope…) to RFC 7946, hurray!

Download and documentation

Go to the Lab page: PHP ShapeFile