shapefileObj
final class shapefileObj (View source)
Properties
rectObj | $bounds | read-only | |
int | $numshapes | read-only | |
string | $source | read-only | |
int | $type | read-only |
Methods
Opens a shapefile and returns a new object to deal with it. Filename should be passed with no extension. To create a new file (or overwrite an existing one), type should be one of MS_SHP_POINT, MS_SHP_ARC, MS_SHP_POLYGON or MS_SHP_MULTIPOINT. Pass type as -1 to open an existing file for read-only access, and type=-2 to open an existing file for update (append).
Old style constructor
Free the object properties and break the internal references.
Details
final
__construct(string $filename, int $type)
Opens a shapefile and returns a new object to deal with it. Filename should be passed with no extension. To create a new file (or overwrite an existing one), type should be one of MS_SHP_POINT, MS_SHP_ARC, MS_SHP_POLYGON or MS_SHP_MULTIPOINT. Pass type as -1 to open an existing file for read-only access, and type=-2 to open an existing file for update (append).
final shapefileObj
ms_newShapefileObj(string $filename, int $type)
Old style constructor
final int
addPoint(pointObj $point)
Appends a point to an open shapefile.
final int
addShape(shapeObj $shape)
Appends a shape to an open shapefile.
final void
free()
Free the object properties and break the internal references.
Note that you have to unset the php variable to free totally the resources. .. note:: The shape file is closed (and changes committed) when the object is destroyed. You can explicitly close and save the changes by calling $shapefile->free(); unset($shapefile), which will also free the php object.
final rectObj
getExtent(int $i)
Retrieve a shape's bounding box by index.
final shapeObj
getPoint(int $i)
Retrieve point by index.
final shapeObj
getShape(int $i)
Retrieve shape by index.