final class shapefileObj (View source)

Properties

rectObj $bounds read-only
int $numshapes read-only
string $source read-only
int $type read-only

Methods

__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).

ms_newShapefileObj(string $filename, int $type)

Old style constructor

int
addPoint(pointObj $point)

Appends a point to an open shapefile.

int
addShape(shapeObj $shape)

Appends a shape to an open shapefile.

void
free()

Free the object properties and break the internal references.

getExtent(int $i)

Retrieve a shape's bounding box by index.

getPoint(int $i)

Retrieve point by index.

getShape(int $i)

Retrieve shape by index.

getTransformed(mapObj $map, int $i)

Retrieve shape by index.

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).

Parameters

string $filename
int $type

final shapefileObj ms_newShapefileObj(string $filename, int $type)

Old style constructor

Parameters

string $filename
int $type

Return Value

shapefileObj

final int addPoint(pointObj $point)

Appends a point to an open shapefile.

Parameters

pointObj $point

Return Value

int

final int addShape(shapeObj $shape)

Appends a shape to an open shapefile.

Parameters

shapeObj $shape

Return Value

int

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.

Return Value

void

final rectObj getExtent(int $i)

Retrieve a shape's bounding box by index.

Parameters

int $i

Return Value

rectObj

final shapeObj getPoint(int $i)

Retrieve point by index.

Parameters

int $i

Return Value

shapeObj

final shapeObj getShape(int $i)

Retrieve shape by index.

Parameters

int $i

Return Value

shapeObj

final shapeObj getTransformed(mapObj $map, int $i)

Retrieve shape by index.

Parameters

mapObj $map
int $i

Return Value

shapeObj