gasparesganga/php-shapefile
Read and write ESRI Shapefiles in PHP with support for common geometry formats. php-shapefile handles SHP/SHX/DBF data, works with WKT and GeoJSON, and includes docs and examples for parsing, editing, and exporting.
ShapefileReader::rewind() pointer resetShapefile::OPTION_IGNORE_FILE_DBFShapefile::OPTION_IGNORE_FILE_SHXShapefileReader::getTotRecords() output constant:
Shapefile::UNKNOWNShapefile::ERR_INPUT_RANDOM_ACCESS_UNAVAILABLEShapefileWriter::packPoint() method affecting Z and M geometriesShapefileWriter.php filefalse value for a Shapefile::DBF_TYPE_LOGICAL fieldShapefile\Geometry\Linestring public methods:
Shapefile\Geometry\Linestring::isClockwise()Shapefile\Geometry\Linestring::forceClockwise()Shapefile\Geometry\Linestring::forceCounterClockwise()Shapefile\Geometry\Linestring::forceClosedRing()Shapefile\Geometry\Polygon public methods:
Shapefile\Geometry\Polygon::isClockwise()Shapefile\Geometry\Polygon::isCounterClockwise()Shapefile\Geometry\Polygon::forceClockwise()Shapefile\Geometry\Polygon::forceCounterClockwise()Shapefile\Geometry\Polygon::forceClosedRings()Shapefile\Geometry\MultiPolygon public methods:
Shapefile\Geometry\MultiPolygon::isClockwise()Shapefile\Geometry\MultiPolygon::isCounterClockwise()Shapefile\Geometry\MultiPolygon::forceClockwise()Shapefile\Geometry\MultiPolygon::forceCounterClockwise()Shapefile\Geometry\MultiPolygon::forceClosedRings()Shapefile\Geometry\GeometryCollection::reverseGeometries() protected method.Shapefile\Geometry\Polygon and Shapefile\Geometry\MultiPolygon optional constructor parameter $force_orientation.Shapefile\ShapefileReader constructor options:
Shapefile::OPTION_POLYGON_CLOSED_RINGS_ACTIONShapefile::OPTION_POLYGON_ORIENTATION_READING_AUTOSENSEShapefile::OPTION_POLYGON_OUTPUT_ORIENTATIONShapefile::ACTION_IGNOREShapefile::ACTION_CHECKShapefile::ACTION_FORCEShapefile::ORIENTATION_CLOCKWISEShapefile::ORIENTATION_COUNTERCLOCKWISEShapefile::ORIENTATION_UNCHANGEDShapefile::ERR_GEOM_RING_AREA_TOO_SMALLShapefile::ERR_GEOM_RING_NOT_ENOUGH_VERTICESShapefile::UNDEFINEDShapefile\Geometry\Polygon and Shapefile\Geometry\MultiPolygon constructor parameter $flag_enforce_closed_rings is now $closed_rings and accepts Shapefile::ACTION_IGNORE, Shapefile::ACTION_CHECK and Shapefile::ACTION_FORCE values.Shapefile\ShapefileReader constructor options that will disappear in the next releases:
Shapefile::OPTION_ENFORCE_POLYGON_CLOSED_RINGS. Use Shapefile::OPTION_POLYGON_CLOSED_RINGS_ACTION instead.Shapefile::OPTION_INVERT_POLYGONS_ORIENTATION. Use Shapefile::OPTION_POLYGON_OUTPUT_ORIENTATION instead.Shapefile::ERR_GEOM_POLYGON_AREA_TOO_SMALL. Use Shapefile::ERR_GEOM_RING_AREA_TOO_SMALL instead.Shapefile::ERR_GEOM_POLYGON_NOT_VALID. Use Shapefile::ERR_GEOM_POLYGON_WRONG_ORIENTATION instead.Shapefile::OPTION_DBF_ALLOW_FIELD_SIZE_255 constructor option for both ShapefileReader and ShapefileWriter classesGEOJSON_BASETYPE constants for Shapefile\Geometry\Linestring and Shapefile\Geometry\MultiLinestring respectively to 'LineString' and 'MultiLineString'Shapefile::OPTION_FORCE_MULTIPART_GEOMETRIES to Point ShapefilesShapefile::OPTION_EXISTING_FILES_MODE is set to Shapefile::MODE_APPENDShapefileWriter. It allows up to a 50% reduction in writing timeShapefileWriter::flushBuffer() methodShapefile::OPTION_BUFFERED_RECORDS constructor option for ShapefileWriter classShapefile::OPTION_EXISTING_FILES_MODE constructor option for ShapefileWriter classShapefile::MODE_PRESERVE, Shapefile::MODE_APPEND, Shapefile::MODE_OVERWRITE constantsisZ(), isM() and getFieldsNames() methods for both ShapefileReader and ShapefileWriter classesShapefileWriter exposes getShapeType(), getBoundingBox(), getPRJ(), getCharset(), setCharset(), getFieldsNames(), getField(), getFieldType(), getFieldSize(), getFieldDecimals(), getFields() and getTotRecords() public methods like ShapefileReaderGeometryCollection::getBoundingBox() method for better performanceShapefileWriter::encodeFieldValue() method for better performance, relying on PHP number_format() for non-textual numeric inputShapefileWriter field-adding methodsShapefile::ERR_DBF_FIELD_NAME_NOT_VALID error type is now defined as "Too many field names conflicting"c+b file access mode for ShapefileWriter classGeometry data when Shapefile::OPTION_DBF_FORCE_ALL_CAPS is enabledShapefile::OPTION_DBF_FORCE_ALL_CAPS optionShapefile::ERR_GEOM_MISSING_FIELD exception was erroneously raised when a field had an explicit null value and Shapefile::OPTION_ENFORCE_GEOMETRY_DATA_STRUCTURE was enabledfread() and fwrite() calls: a ShapefileException is thrown anywaysShapefile::ERR_GEOM_MISSING_FIELD is raised1, not from 0)ShapefileWriter destructor when no record has been written yet$flag_sanitize_name parameter from all field-adding methodsShapefile::OPTION_OVERWRITE_EXISTING_FILES constructor option for ShapefileWriter classShapefile::ERR_DBF_FIELD_NAME_NOT_UNIQUE error typePolygon and MultiPolygon addGeometry protected methodsShapefile\Geometry namespace with Point, MultiPoint, Linestring, MultiLinestring, Polygon and MultiPolygon classesShapefileReader and ShapefileWriter classesShapefile, Geometry and GeometryCollection abstract classesnull values in DBF filesMEMO fields)ShapefileException::getDetails() methodShapefile::OPTION_CPG_ENABLE_FOR_DEFAULT_CHARSETShapefile::OPTION_DBF_CONVERT_TO_UTF8Shapefile::OPTION_DBF_FORCE_ALL_CAPSShapefile::OPTION_DBF_IGNORED_FIELDSShapefile::OPTION_DBF_NULL_PADDING_CHARShapefile::OPTION_DBF_NULLIFY_INVALID_DATESShapefile::OPTION_DBF_RETURN_DATES_AS_OBJECTSShapefile::OPTION_DELETE_EMPTY_FILESShapefile::OPTION_ENFORCE_GEOMETRY_DATA_STRUCTUREShapefile::OPTION_ENFORCE_POLYGON_CLOSED_RINGSShapefile::OPTION_FORCE_MULTIPART_GEOMETRIESShapefile::OPTION_IGNORE_GEOMETRIES_BBOXESShapefile::OPTION_IGNORE_SHAPEFILE_BBOXShapefile::OPTION_INVERT_POLYGONS_ORIENTATIONShapefile::OPTION_OVERWRITE_EXISTING_FILESShapefile::OPTION_SUPPRESS_MShapefile::OPTION_SUPPRESS_ZShapefile::FILE_SHPShapefile::FILE_SHXShapefile::FILE_DBFShapefile::FILE_DBTShapefile::FILE_PRJShapefile::FILE_CPGShapefile::SHAPE_TYPE_NULLShapefile::SHAPE_TYPE_POINTShapefile::SHAPE_TYPE_POLYLINEShapefile::SHAPE_TYPE_POLYGONShapefile::SHAPE_TYPE_MULTIPOINTShapefile::SHAPE_TYPE_POINTZShapefile::SHAPE_TYPE_POLYLINEZShapefile::SHAPE_TYPE_POLYGONZShapefile::SHAPE_TYPE_MULTIPOINTZShapefile::SHAPE_TYPE_POINTMShapefile::SHAPE_TYPE_POLYLINEMShapefile::SHAPE_TYPE_POLYGONMShapefile::SHAPE_TYPE_MULTIPOINTMShapefile::DBF_TYPE_CHARShapefile::DBF_TYPE_DATEShapefile::DBF_TYPE_LOGICALShapefile::DBF_TYPE_MEMOShapefile::DBF_TYPE_NUMERICShapefile::DBF_TYPE_FLOATShapefile::ERR_UNDEFINEDShapefile::ERR_FILE_MISSINGShapefile::ERR_FILE_EXISTSShapefile::ERR_FILE_INVALID_RESOURCEShapefile::ERR_FILE_OPENShapefile::ERR_FILE_READINGShapefile::ERR_FILE_WRITINGShapefile::ERR_SHP_TYPE_NOT_SUPPORTEDShapefile::ERR_SHP_TYPE_NOT_SETShapefile::ERR_SHP_TYPE_ALREADY_SETShapefile::ERR_SHP_GEOMETRY_TYPE_NOT_COMPATIBLEShapefile::ERR_SHP_MISMATCHED_BBOXShapefile::ERR_SHP_FILE_ALREADY_INITIALIZEDShapefile::ERR_SHP_WRONG_RECORD_TYPEShapefile::ERR_DBF_FILE_NOT_VALIDShapefile::ERR_DBF_MISMATCHED_FILEShapefile::ERR_DBF_EOF_REACHEDShapefile::ERR_DBF_MAX_FIELD_COUNT_REACHEDShapefile::ERR_DBF_FIELD_NAME_NOT_UNIQUEShapefile::ERR_DBF_FIELD_NAME_NOT_VALIDShapefile::ERR_DBF_FIELD_TYPE_NOT_VALIDShapefile::ERR_DBF_FIELD_SIZE_NOT_VALIDShapefile::ERR_DBF_FIELD_DECIMALS_NOT_VALIDShapefile::ERR_DBF_CHARSET_CONVERSIONShapefile::ERR_DBT_EOF_REACHEDShapefile::ERR_GEOM_NOT_EMPTYShapefile::ERR_GEOM_COORD_VALUE_NOT_VALIDShapefile::ERR_GEOM_MISMATCHED_DIMENSIONSShapefile::ERR_GEOM_MISMATCHED_BBOXShapefile::ERR_GEOM_MISSING_FIELDShapefile::ERR_GEOM_POINT_NOT_VALIDShapefile::ERR_GEOM_POLYGON_OPEN_RINGShapefile::ERR_GEOM_POLYGON_AREA_TOO_SMALLShapefile::ERR_GEOM_POLYGON_NOT_VALIDShapefile::ERR_INPUT_RECORD_NOT_FOUNDShapefile::ERR_INPUT_FIELD_NOT_FOUNDShapefile::ERR_INPUT_GEOMETRY_TYPE_NOT_VALIDShapefile::ERR_INPUT_GEOMETRY_INDEX_NOT_VALIDShapefile::ERR_INPUT_ARRAY_NOT_VALIDShapefile::ERR_INPUT_WKT_NOT_VALIDShapefile::ERR_INPUT_GEOJSON_NOT_VALIDShapefile::ERR_INPUT_NUMERIC_VALUE_OVERFLOWsrc/ reflects namespaces hierarchyiconv() instead of utf8_encode() for charset conversionShapefileException::getErrorType() method returns one of Shapefile::ERR_* constant valuesShapefileReader::fetchRecord() method replaces ShapefileReader::getRecord() and returns an objectbool) not initialized values (null) detection in DBF filesShapefileReader public methods:
setDefaultGeometryFormat()readRecord()ShapefileReader protected method init()Shapefile constants:
Shapefile::FLAG_SUPPRESS_ZShapefile::FLAG_SUPPRESS_MShapefile::GEOMETRY_ARRAYShapefile::GEOMETRY_WKTShapefile::GEOMETRY_GEOJSON_GEOMETRYShapefile::GEOMETRY_GEOJSON_FEATUREShapefile::GEOMETRY_BOTHShapefile numeric error codessetDefaultGeometryFormat(). It sets the default format for future calls to getRecord() and use with the Iterator interface (foreach loop)GEOMETRY_GEOJSON_GEOMETRY and GEOMETRY_GEOJSON_FEATURE formats for getRecord() methodgetRecord() can be combined using bitwise Or operator |getRecord() method changed to ShapeFile::GEOMETRY_ARRAYGEOMETRY_BOTH geometry return format for getRecord() method - Please update your code still relying on itinit() allows the main ShapeFile class to be easily extended using a custom constructorgetTotRecords(). It provides the number of records in the shapefilesetCurrentRecord(). It sets the current record pointergetCurrentRecord(). It gets the current record pointergetDBFFields(). It provides the fields definition in the DBF filegetRecord() methodFLAG_SUPPRESS_Z and FLAG_SUPPRESS_M flags for ShapeFile constructorGEOMETRY_BOTH format for getRecord() methodShapeFile namespace and ShapeFileAutoloader class41 and 42getPRJ(). It provides the raw WKT from the .prj file if presentFirst public release
How can I help you explore Laravel packages today?