PHP Shapefile 3.3.0
Polygons/MultiPolygons rings orientation made simple
23 May 2020
After that last underwhelming (feature-wise) release, this new minor version comes with many new features and capabilities.
Lately I have received an interesting amount of feedback from users from a specific country who are dealing with some official shapefiles that are not compliant with ESRI specs, especially when it comes to Polygons/MultiPolygons orientation.
This new release is focused on this specific aspect, adding a number of new methods to check and manipulate Polygons/MultiPolygons rings and autosensing capabilities when reading shapefiles.
The result is more flexibility than ever, a wider out-of-the-box compatibility with different (and uncompliant…) shapefiles and a simpler yet more precise approach to ring orientation.
In order to have clearer idea of new default behaviour (which is no different than before in presence of a compliat shapefile of course) and capabilities, please read this note about Polygons orientation.
What’s new in Version 3.3.0
Shapefile\Geometry\Linestringclass counts with 4 new public methods:
Shapefile\Geometry\Polygonclass counts with 5 new public methods:
Shapefile\Geometry\MultiPolygonclass counts with 5 new public methods:
$flag_enforce_closed_ringsis now $closed_rings and accepts
Shapefile\Geometry\MultiPolygonoptional constructor parameter $force_orientation.
- New action constants:
- New Polygon and MultiPolygon orientation constants:
- New error types constants:
- Other constants:
- Library implements a fluent interface that allows method chaining (Actually I am not a fan of this, but I reckon many developers like it, hence here it is).
- Code is now PSR-12 compliant
Shapefile\ShapefileReaderconstructor options that will disappear in the next releases:
- Deprecated error constants that will disappear in the next releases:
- Improved documentation navigation and format.
Download and documentation
Go to the Lab page: PHP Shapefile