evandrobm/easy-shapefile-parser

Easy SHP/DBF Reader/Parse Without Using dbase Library/Functions


Keywords
dbase, Shapefile, shp, dbf
License
GPL-2.0+

Documentation

Easy ShapeFile (SHP/DBF) Parser

A PHP library to parse ESRI Shape files without dbase library installed on your server.

Based on Luca Capra (muka) Library at https://github.com/muka/ShapeReader Using Erwin Kooi package PHPXBase to read DBF without native dbase functions at http://www.phpclasses.org/package/2673-PHP-Access-dbf-foxpro-files-without-PHP-ext-.html

Install

composer require evandrobm/EasyShapeFileParser

Usage

$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

2016-09-02 - Merged two packages to send to Packagist

License

GNU General Public License http://opensource.org/licenses/GPL-3.0