https://github.com/muka/shapereader
A PHP library to parse ESRI Shape files
https://github.com/muka/shapereader
Last synced: 8 months ago
JSON representation
A PHP library to parse ESRI Shape files
- Host: GitHub
- URL: https://github.com/muka/shapereader
- Owner: muka
- Created: 2013-08-25T20:34:05.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2021-06-24T10:50:43.000Z (over 4 years ago)
- Last Synced: 2025-05-04T07:46:37.710Z (8 months ago)
- Language: PHP
- Size: 1.45 MB
- Stars: 11
- Watchers: 2
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ShapeReader
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