From 3c7e4cb80edb40ff184e3971458577a04845f8da Mon Sep 17 00:00:00 2001 From: Gaspare Sganga Date: Sat, 23 Jan 2021 09:10:45 +0100 Subject: [PATCH] v3.4.0 --- CHANGELOG.md | 42 ++++++++++++++----- LICENSE | 2 +- VERSION | 2 +- src/Shapefile/Geometry/Geometry.php | 2 +- src/Shapefile/Geometry/GeometryCollection.php | 2 +- src/Shapefile/Geometry/Linestring.php | 2 +- src/Shapefile/Geometry/MultiLinestring.php | 2 +- src/Shapefile/Geometry/MultiPoint.php | 2 +- src/Shapefile/Geometry/MultiPolygon.php | 2 +- src/Shapefile/Geometry/Point.php | 2 +- src/Shapefile/Geometry/Polygon.php | 2 +- src/Shapefile/Shapefile.php | 4 +- src/Shapefile/ShapefileAutoloader.php | 2 +- src/Shapefile/ShapefileException.php | 2 +- src/Shapefile/ShapefileReader.php | 2 +- src/Shapefile/ShapefileWriter.php | 2 +- 16 files changed, 48 insertions(+), 26 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 48a7db6..14f7ebd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,9 +5,31 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/) and this project adheres to [Semantic Versioning](https://semver.org/). +## v3.4.0 - 2021-01-23 +### Added +- Full GeoJSON *Feature* support with properties data +- Capability to ignore *DBF* and *SHX* files to recover corrupted Shapefiles +- ShapefileReader constructor options constants: + - `Shapefile::OPTION_IGNORE_FILE_DBF` + - `Shapefile::OPTION_IGNORE_FILE_SHX` +- `ShapefileReader::getTotRecords()` output constant: + - `Shapefile::UNKNOWN` +- Error types constants: + - `Shapefile::ERR_INPUT_RANDOM_ACCESS_UNAVAILABLE` + +### Changed +- Improved handling of *Logical* fields in *DBF* files +- Increased tolerance coefficient to deal with extremely small areas when determining ring orientation + +### Fixed +- Handling of unspecified bounding box in *SHP* and *SHX* file headers for empty Shapefiles +- Behaviour with *DBF* files for empty Shapefiles + + + ## v3.3.3 - 2020-09-17 ### Fixed -- Bug in ShapefileWriter::packPoint() method affecting *Z* and *M* geometries +- Bug in `ShapefileWriter::packPoint()` method affecting *Z* and *M* geometries @@ -111,7 +133,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/). - `Shapefile::OPTION_EXISTING_FILES_MODE` constructor option for `ShapefileWriter` class - `Shapefile::MODE_PRESERVE`, `Shapefile::MODE_APPEND`, `Shapefile::MODE_OVERWRITE` constants - `isZ()`, `isM()` and `getFieldsNames()` methods for both `ShapefileReader` and `ShapefileWriter` classes -- `ShapefileWriter` expose `getShapeType()`, `getBoundingBox()`, `getPRJ()`, `getCharset()`, `setCharset()`, `getFieldsNames()`, `getField()`, `getFieldType()`, `getFieldSize()`, `getFieldDecimals()`, `getFields()` and `getTotRecords()` public methods like `ShapefileReader` +- `ShapefileWriter` exposes `getShapeType()`, `getBoundingBox()`, `getPRJ()`, `getCharset()`, `setCharset()`, `getFieldsNames()`, `getField()`, `getFieldType()`, `getFieldSize()`, `getFieldDecimals()`, `getFields()` and `getTotRecords()` public methods like `ShapefileReader` - Sanitize and accept conflicting and duplicated field names - Other minor code and performance improvements across the library @@ -128,7 +150,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/). - `Shapefile::ERR_GEOM_MISSING_FIELD` exception was erroneously raised when a field had an explicit `null` value and `Shapefile::OPTION_ENFORCE_GEOMETRY_DATA_STRUCTURE` was enabled - Suppress PHP warnings in `fread()` and `fwrite()` calls: a `ShapefileException` is thrown anyways - Bug causing a corrupted *DBF* file when a `Shapefile::ERR_GEOM_MISSING_FIELD` is raised -- Bug causing wrong record number to be written in SHP record headers (count starts from `1`, not from `0`) +- Bug causing wrong record number to be written in *SHP* record headers (count starts from `1`, not from `0`) - Corner case bug affecting `ShapefileWriter` destructor when no record has been written yet ### Removed @@ -287,7 +309,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/). ## v2.4.3 - 2018-04-07 ### Fixed -- Bug in binary reading function causing issues with DBF fields size +- Bug in binary reading function causing issues with *DBF* fields size @@ -336,16 +358,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/). - Error code 91: RECORD_INDEX_NOT_VALID ### Changed -- Class constructor: SHX file is now required +- Class constructor: *SHX* file is now required ### Fixed -- Handles eventual useless random bytes between records in the SHP file (using the SHX file for the correct offsets) +- Handles eventual useless random bytes between records in the *SHP* file (using the *SHX* file for the correct offsets) ## v2.1.0 - 2016-11-17 ### Added -- Public method `getDBFFields()`. It provides the fields definition in the DBF file +- Public method `getDBFFields()`. It provides the fields definition in the *DBF* file @@ -358,17 +380,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/). ## v2.0.0 - 2016-11-01 ### Added - Support for Z and M shapes -- Native DBF reading capabilities (no dbase functions or external libraries required anymore) +- Native *DBF* reading capabilities (no dbase functions or external libraries required anymore) - `FLAG_SUPPRESS_Z` and `FLAG_SUPPRESS_M` flags for ShapeFile constructor - `GEOMETRY_BOTH` format for `getRecord()` method - `ShapeFile` namespace and `ShapeFileAutoloader` class -- DBF error codes `41` and `42` +- *DBF* error codes `41` and `42` - CHANGELOG file ### Changed - Code is now php-fig PSR-1, PSR-2 and PSR-4 compliant - PHP 7 compatible -- All strings read from DBF are returned already encoded in utf-8 +- All strings read from *DBF* are returned already encoded in utf-8 ### Removed - PHP XBase library dependency as dbase fallback diff --git a/LICENSE b/LICENSE index c0662c7..6c8db0b 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2014-2020 Gaspare Sganga +Copyright (c) 2014-2021 Gaspare Sganga Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/VERSION b/VERSION index 3f09e91..fbcbf73 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.3.3 \ No newline at end of file +3.4.0 \ No newline at end of file diff --git a/src/Shapefile/Geometry/Geometry.php b/src/Shapefile/Geometry/Geometry.php index 21809de..39f62a2 100644 --- a/src/Shapefile/Geometry/Geometry.php +++ b/src/Shapefile/Geometry/Geometry.php @@ -5,7 +5,7 @@ * * @package Shapefile * @author Gaspare Sganga - * @version 3.3.3 + * @version 3.4.0 * @license MIT * @link https://gasparesganga.com/labs/php-shapefile/ */ diff --git a/src/Shapefile/Geometry/GeometryCollection.php b/src/Shapefile/Geometry/GeometryCollection.php index d282abc..2a9e0d2 100644 --- a/src/Shapefile/Geometry/GeometryCollection.php +++ b/src/Shapefile/Geometry/GeometryCollection.php @@ -5,7 +5,7 @@ * * @package Shapefile * @author Gaspare Sganga - * @version 3.3.3 + * @version 3.4.0 * @license MIT * @link https://gasparesganga.com/labs/php-shapefile/ */ diff --git a/src/Shapefile/Geometry/Linestring.php b/src/Shapefile/Geometry/Linestring.php index 93890c9..760059c 100644 --- a/src/Shapefile/Geometry/Linestring.php +++ b/src/Shapefile/Geometry/Linestring.php @@ -5,7 +5,7 @@ * * @package Shapefile * @author Gaspare Sganga - * @version 3.3.3 + * @version 3.4.0 * @license MIT * @link https://gasparesganga.com/labs/php-shapefile/ */ diff --git a/src/Shapefile/Geometry/MultiLinestring.php b/src/Shapefile/Geometry/MultiLinestring.php index d2f0d28..7c352ab 100644 --- a/src/Shapefile/Geometry/MultiLinestring.php +++ b/src/Shapefile/Geometry/MultiLinestring.php @@ -5,7 +5,7 @@ * * @package Shapefile * @author Gaspare Sganga - * @version 3.3.3 + * @version 3.4.0 * @license MIT * @link https://gasparesganga.com/labs/php-shapefile/ */ diff --git a/src/Shapefile/Geometry/MultiPoint.php b/src/Shapefile/Geometry/MultiPoint.php index e1ad066..520ca1b 100644 --- a/src/Shapefile/Geometry/MultiPoint.php +++ b/src/Shapefile/Geometry/MultiPoint.php @@ -5,7 +5,7 @@ * * @package Shapefile * @author Gaspare Sganga - * @version 3.3.3 + * @version 3.4.0 * @license MIT * @link https://gasparesganga.com/labs/php-shapefile/ */ diff --git a/src/Shapefile/Geometry/MultiPolygon.php b/src/Shapefile/Geometry/MultiPolygon.php index d68af60..3b5caf6 100644 --- a/src/Shapefile/Geometry/MultiPolygon.php +++ b/src/Shapefile/Geometry/MultiPolygon.php @@ -5,7 +5,7 @@ * * @package Shapefile * @author Gaspare Sganga - * @version 3.3.3 + * @version 3.4.0 * @license MIT * @link https://gasparesganga.com/labs/php-shapefile/ */ diff --git a/src/Shapefile/Geometry/Point.php b/src/Shapefile/Geometry/Point.php index 1d234c7..ccc000c 100644 --- a/src/Shapefile/Geometry/Point.php +++ b/src/Shapefile/Geometry/Point.php @@ -5,7 +5,7 @@ * * @package Shapefile * @author Gaspare Sganga - * @version 3.3.3 + * @version 3.4.0 * @license MIT * @link https://gasparesganga.com/labs/php-shapefile/ */ diff --git a/src/Shapefile/Geometry/Polygon.php b/src/Shapefile/Geometry/Polygon.php index e3e8c46..c0579a9 100644 --- a/src/Shapefile/Geometry/Polygon.php +++ b/src/Shapefile/Geometry/Polygon.php @@ -5,7 +5,7 @@ * * @package Shapefile * @author Gaspare Sganga - * @version 3.3.3 + * @version 3.4.0 * @license MIT * @link https://gasparesganga.com/labs/php-shapefile/ */ diff --git a/src/Shapefile/Shapefile.php b/src/Shapefile/Shapefile.php index ca6d7a5..d9d411f 100644 --- a/src/Shapefile/Shapefile.php +++ b/src/Shapefile/Shapefile.php @@ -5,7 +5,7 @@ * * @package Shapefile * @author Gaspare Sganga - * @version 3.3.3 + * @version 3.4.0 * @license MIT * @link https://gasparesganga.com/labs/php-shapefile/ */ @@ -201,7 +201,7 @@ abstract class Shapefile /** * Ignores SHX file (useful to recover corrupted Shapefiles). - * This might not always work as it relies on SHP records headers content lengths + * This might not always work as it relies on SHP record headers content lengths * and assumes there are no unused bytes between records in SHP file. * Random access to specific records will not be possible. * ShapefileReader diff --git a/src/Shapefile/ShapefileAutoloader.php b/src/Shapefile/ShapefileAutoloader.php index 232d05a..bacbea6 100644 --- a/src/Shapefile/ShapefileAutoloader.php +++ b/src/Shapefile/ShapefileAutoloader.php @@ -5,7 +5,7 @@ * * @package Shapefile * @author Gaspare Sganga - * @version 3.3.3 + * @version 3.4.0 * @license MIT * @link https://gasparesganga.com/labs/php-shapefile/ */ diff --git a/src/Shapefile/ShapefileException.php b/src/Shapefile/ShapefileException.php index bc12971..7e39797 100644 --- a/src/Shapefile/ShapefileException.php +++ b/src/Shapefile/ShapefileException.php @@ -5,7 +5,7 @@ * * @package Shapefile * @author Gaspare Sganga - * @version 3.3.3 + * @version 3.4.0 * @license MIT * @link https://gasparesganga.com/labs/php-shapefile/ */ diff --git a/src/Shapefile/ShapefileReader.php b/src/Shapefile/ShapefileReader.php index d080f3e..c1583f9 100644 --- a/src/Shapefile/ShapefileReader.php +++ b/src/Shapefile/ShapefileReader.php @@ -5,7 +5,7 @@ * * @package Shapefile * @author Gaspare Sganga - * @version 3.3.3 + * @version 3.4.0 * @license MIT * @link https://gasparesganga.com/labs/php-shapefile/ */ diff --git a/src/Shapefile/ShapefileWriter.php b/src/Shapefile/ShapefileWriter.php index fcefbc6..7ecb8e7 100644 --- a/src/Shapefile/ShapefileWriter.php +++ b/src/Shapefile/ShapefileWriter.php @@ -5,7 +5,7 @@ * * @package Shapefile * @author Gaspare Sganga - * @version 3.3.3 + * @version 3.4.0 * @license MIT * @link https://gasparesganga.com/labs/php-shapefile/ */