muka / shape-reader
A PHP library to parse ESRI Shape files
Installs: 27 211
Dependents: 1
Suggesters: 0
Security: 0
Stars: 11
Watchers: 3
Forks: 4
Open Issues: 1
This package is not auto-updated.
Last update: 2024-12-17 03:09:43 UTC
README
A PHP library to parse ESRI Shape files.
Based on the great work of Juan Carlos Gonzalez Ulloa and David Granqvist
A copy of the original work is available at http://www.phpclasses.org/package/1741-PHP-Read-vectorial-data-from-geographic-shape-files.html
This library is meant to read vectorial information from shape files in the SHP format.
The SHP file format is an open standard for storing vectorial information that is used to distribute geographical information.
Plenty of commercial and open source applications are able to read from it.
Requirements
PHP version should be > 5.3.2
To open the DBF related database you need the dbase extension available as PECL package.
pecl install dbase
echo "extension=dbase.so" > /etc/php5/conf.d/dbase.ini
Usage
See examples folder for details.
$shpReader = new ShapeReader("./somewhere.shp");
$i = 0;
while ($record = $shpReader->getNext() and $i < 5) {
//Dump SHP information
$shp_data = $record->getData();
var_dump($shp_data);
//Dump DBF information
$dbf_data = $record->getDbfData();
var_dump($dbf_data);
$i++;
}
Changelog
2013-08-24 - Base refactor, added namespace support, composer and test cases
License
GNU General Public License http://opensource.org/licenses/GPL-2.0