final class mapObj (View source)

Properties

float $cellsize
int $debug
float $defresolution

pixels per inch, defaults to 72

rectObj $extent ;
string $fontsetfilename

read-only, set by setFontSet()

int $height

see setSize()

colorObj $imagecolor
int $keysizex
int $keysizey
int $keyspacingx
int $keyspacingy
labelcacheObj $labelcache

no members. Used only to free the label cache (map->labelcache->free()

legendObj $legend
string $mappath
int $maxsize
hashTableObj $metadata
string $name
int $numlayers read-only
outputformatObj $outputformat
int $numoutputformats read-only
projectionObj $projection
querymapObj $querymap
referenceMapObj $reference
float $resolution

pixels per inch, defaults to 72

scalebarObj $scalebar
float $scaledenom

read-only, set by drawMap()

string $shapepath
int $status
string $symbolsetfilename

read-only, set by setSymbolSet()

int $units

map units type

webObj $web
int $width

see setSize()

Methods

__construct(string $map_file_name, string $new_map_path)

Returns a new object to deal with a MapServer map file.

ms_newMapObjFromString(string $map_file_string, string $new_map_path)

Old style constructor

int
applyconfigoptions()

Applies the config options set in the map file. For example setting the PROJ_LIB using the setconfigoption only modifies the value in the map object. applyconfigoptions will actually change the PROJ_LIB value that will be used when dealing with projection.

int
applySLD(string $sldxml)

Apply the :ref:SLD document to the map file. The matching between the sld document and the map file will be done using the layer's name.

int
applySLDURL(string $sldurl)

Apply the SLD document pointed by the URL to the map file. The matching between the sld document and the map file will be done using the layer's name.

string
convertToString()

Saves the object to a string.

imageObj|null
draw()

Render map and return an image object or NULL on error.

int
drawLabelCache(imageObj $image)

Renders the labels for a map. Returns MS_SUCCESS or MS_FAILURE on error.

drawLegend()

Render legend and return an image object.

imageObj|null
drawQuery()

Render a query map and return an image object or NULL on error.

drawReferenceMap()

Render reference map and return an image object.

drawScaleBar()

Render scale bar and return an image object.

int
embedLegend(imageObj $image)

embeds a legend. Actually the legend is just added to the label cache so you must invoke drawLabelCache() to actually do the rendering (unless postlabelcache is set in which case it is drawn right away). Returns MS_SUCCESS or MS_FAILURE on error.

int
embedScalebar(imageObj $image)

embeds a scalebar. Actually the scalebar is just added to the label cache so you must invoke drawLabelCache() to actually do the rendering (unless postlabelcache is set in which case it is drawn right away).

void
free()

Free the object properties and break the internal references.

string
generateSLD()

Returns an SLD XML string based on all the classes found in all the layers that have STATUS on.

array
getAllGroupNames()

Return an array containing all the group names used in the layers. If there are no groups, it returns an empty array.

array
getAllLayerNames()

Return an array containing all the layer names.

getColorbyIndex(int $iCloIndex)

Returns a colorObj corresponding to the color index in the palette.

string
getConfigOption(string $key)

Returns the config value associated with the key.

getLabel(int $index)

Returns a labelcacheMemberObj from the map given an index value (0=first label). Labelcache has to be enabled.

getLayer(int $index)

Returns a layerObj from the map given an index value (0=first layer)

getLayerByName(string $layer_name)

Returns a layerObj from the map given a layer name.

array
getLayersDrawingOrder()

Return an array containing layer's index in the order which they are drawn. If there are no layers, it returns an empty array.

array
getLayersIndexByGroup(string $groupname)

Return an array containing all the layer's indexes given a group name. If there are no layers, it returns an empty array.

int
getMetaData(string $name)

Fetch metadata entry by name (stored in the :ref:WEB object in the map file). Returns "" if no entry matches the name.

int
getNumSymbols()

Return the number of symbols in map.

string
getProjection()

Returns a string representation of the projection.

int
getSymbolByName(string $symbol_name)

Returns the symbol index using the name.

getSymbolObjectById(int $symbolid)

Returns the symbol object using a symbol id. Refer to the symbol object reference section for more details.

int
loadMapContext(string $filename, bool $unique_layer_name)

Available only if WMS support is enabled. Load a :ref:WMS Map Context <map_context> XML file into the current mapObj. If the map already contains some layers then the layers defined in the WMS Map context document are added to the current map. The 2nd argument unique_layer_name is optional and if set to MS_TRUE layers created will have a unique name (unique prefix added to the name). If set to MS_FALSE the layer name will be the the same name as in the context. The default value is MS_FALSE. Returns MS_SUCCESS/MS_FAILURE.

int
loadOWSParameters(OwsrequestObj $request, string $version)

Load OWS request parameters (BBOX, LAYERS, &c.) into map. Returns MS_SUCCESS or MS_FAILURE. 2nd argument version is not mandatory.

int
moveLayerDown(int $layerindex)

Move layer down in the hierarchy of drawing.

int
moveLayerUp(int $layerindex)

Move layer up in the hierarchy of drawing.

int
offsetExtent(float $x, float $y)

Offset the map extent based on the given distances in map coordinates.

int
owsDispatch(OwsrequestObj $request)

Processes and executes the passed OpenGIS Web Services request on the map. Returns MS_DONE (2) if there is no valid OWS request in the req object, MS_SUCCESS (0) if an OWS request was successfully processed and MS_FAILURE (1) if an OWS request was not successfully processed. OWS requests include :ref:WMS <wms_server>, :ref:WFS <wfs_server>, :ref:WCS <wcs_server> and :ref:SOS <sos_server> requests supported by MapServer.

prepareImage()

Return a blank image object.

void
prepareQuery()

Calculate the scale of the map and set map->scaledenom.

string
processLegendTemplate(array $params)

Process legend template files and return the result in a buffer.

string
processQueryTemplate(array $params, bool $generateimages)

Process query template files and return the result in a buffer.

string
processTemplate(array $params, bool $generateimages)

Process the template file specified in the web object and return the result in a buffer. The processing consists of opening the template file and replace all the tags found in it. Only tags that have an equivalent element in the map object are replaced (ex [scaledenom]).

int
queryByFeatures(int $slayer)

Perform a query based on a previous set of results from a layer. At present the results MUST be based on a polygon layer.

int
queryByIndex($layerindex, $tileindex, $shapeindex, $addtoquery)

Add a specific shape on a given layer to the query result.

int
queryByPoint(pointObj $point, int $mode, float $buffer)

Query all selected layers in map at point location specified in georeferenced map coordinates (i.e. not pixels).

int
queryByRect(rectObj $rect)

Query all selected layers in map using a rectangle specified in georeferenced map coordinates (i.e. not pixels). The query is performed on all the shapes that are part of a :ref:CLASS that contains a :ref:TEMPLATE value or that match any class in a layer that contains a :ref:LAYER :ref:TEMPLATE <template> value. Returns MS_SUCCESS if shapes were found or MS_FAILURE if nothing was found or if some other error happened (note that the error message in case nothing was found can be avoided in PHP using the '@' control operator).

int
queryByShape(shapeObj $shape)

Query all selected layers in map based on a single shape, the shape has to be a polygon at this point.

removeLayer(int $nIndex)

Remove a layer from the mapObj. The argument is the index of the layer to be removed. Returns the removed layerObj on success, else null.

int
removeMetaData(string $name)

Remove a metadata entry for the map (stored in the WEB object in the map file). Returns MS_SUCCESS/MS_FAILURE.

int
save(string $filename)

Save current map object state to a file. Returns -1 on error.

int
saveMapContext(string $filename)

Available only if WMS support is enabled. Save current map object state in :ref:WMS Map Context <map_context> format. Only WMS layers are saved in the WMS Map Context XML file. Returns MS_SUCCESS/MS_FAILURE.

int
saveQuery(string $filename, int $results)

Save the current query in a file. Results determines the save format - MS_TRUE (or 1/true) saves the query results (tile index and shape index), MS_FALSE (or 0/false) the query parameters (and the query will be re-run in loadquery). Returns MS_SUCCESS or MS_FAILURE. Either save format can be used with loadquery. See RFC 65 and ticket #3647 for details of different save formats.

int
scaleExtent(float $zoomfactor, float $minscaledenom, float $maxscaledenom)

Scale the map extent using the zoomfactor and ensure the extent within the minscaledenom and maxscaledenom domain. If minscaledenom and/or maxscaledenom is 0 then the parameter is not taken into account. Returns MS_SUCCESS or MS_FAILURE.

int
selectOutputFormat(string $type)

Selects the output format to be used in the map.

int
appendOutputFormat(outputFormatObj $outputFormat)

Appends outputformat object in the map object.

int
removeOutputFormat(string $name)

Remove outputformat from the map.

outputFormatObj
getOutputFormat(int $index)

Returns the outputformat at index position.

int
set(string $property_name, $new_value)

Set map object property to new value.

int
setCenter(pointObj $center)

Set the map center to the given map point.

int
setConfigOption(string $key, string $value)

Sets a config parameter using the key and the value passed

void
setExtent(float $minx, float $miny, float $maxx, float $maxy)

Set the map extents using the georef extents passed in argument.

int
setFontSet(string $fileName)

Load and set a new :ref:fontset.

int
setMetaData(string $name, string $value)

Set a metadata entry for the map (stored in the WEB object in the map file). Returns MS_SUCCESS/MS_FAILURE.

int
setProjection(string $proj_params, bool $bSetUnitsAndExtents)

Set map projection and coordinate system. Returns MS_SUCCESS or MS_FAILURE on error.

int
setRotation(float $rotation_angle)

Set map rotation angle. The map view rectangle (specified in EXTENTS) will be rotated by the indicated angle in the counter- clockwise direction. Note that this implies the rendered map will be rotated by the angle in the clockwise direction.

int
setSize(int $width, int $height)

Set the map width and height. This method updates the internal geotransform and other data structures required for map rotation so it should be used instead of setting the width and height members directly.

int
setSymbolSet(string $fileName)

Load and set a symbol file dynamically.

int
setWKTProjection(string $proj_params, bool $bSetUnitsAndExtents)

Same as setProjection(), but takes an OGC WKT projection definition string as input. Returns MS_SUCCESS or MS_FAILURE on error.

int
zoomPoint(int $nZoomFactor, pointObj $oPixelPos, int $nImageWidth, int $nImageHeight, rectObj $oGeorefExt)

Zoom to a given XY position. Returns MS_SUCCESS or MS_FAILURE on error.

int
zoomRectangle(rectObj $oPixelExt, int $nImageWidth, int $nImageHeight, rectObj $oGeorefExt)

Set the map extents to a given extents. Returns MS_SUCCESS or MS_FAILURE on error.

int
zoomScale(float $nScaleDenom, pointObj $oPixelPos, int $nImageWidth, int $nImageHeight, rectObj $oGeorefExt, rectObj $oMaxGeorefExt)

Zoom in or out to a given XY position so that the map is displayed at specified scale. Returns MS_SUCCESS or MS_FAILURE on error.

Details

final __construct(string $map_file_name, string $new_map_path)

Returns a new object to deal with a MapServer map file.

Construct a new mapObj from a mapfile string. Returns a new object to deal with a MapServer map file. .. note:: By default, the SYMBOLSET, FONTSET, and other paths in the mapfile are relative to the mapfile location. If new_map_path is provided then this directory will be used as the base path for all the rewlative paths inside the mapfile.

Parameters

string $map_file_name
string $new_map_path

final mapObj ms_newMapObjFromString(string $map_file_string, string $new_map_path)

Old style constructor

Parameters

string $map_file_string
string $new_map_path

Return Value

mapObj

final int applyconfigoptions()

Applies the config options set in the map file. For example setting the PROJ_LIB using the setconfigoption only modifies the value in the map object. applyconfigoptions will actually change the PROJ_LIB value that will be used when dealing with projection.

Return Value

int

final int applySLD(string $sldxml)

Apply the :ref:SLD document to the map file. The matching between the sld document and the map file will be done using the layer's name.

See :ref:SLD HowTo <sld> for more information on the SLD support.

Parameters

string $sldxml

Return Value

int

final int applySLDURL(string $sldurl)

Apply the SLD document pointed by the URL to the map file. The matching between the sld document and the map file will be done using the layer's name.

See :ref:SLD HowTo <sld> for more information on the SLD support.

Parameters

string $sldurl

Return Value

int

final string convertToString()

Saves the object to a string.

.. note:: The inverse method updateFromString does not exist for the mapObj .. versionadded:: 6.4

Return Value

string

final imageObj|null draw()

Render map and return an image object or NULL on error.

Return Value

imageObj|null

final int drawLabelCache(imageObj $image)

Renders the labels for a map. Returns MS_SUCCESS or MS_FAILURE on error.

Parameters

imageObj $image

Return Value

int

final imageObj drawLegend()

Render legend and return an image object.

Return Value

imageObj

final imageObj|null drawQuery()

Render a query map and return an image object or NULL on error.

Return Value

imageObj|null

final imageObj drawReferenceMap()

Render reference map and return an image object.

Return Value

imageObj

final imageObj drawScaleBar()

Render scale bar and return an image object.

Return Value

imageObj

final int embedLegend(imageObj $image)

embeds a legend. Actually the legend is just added to the label cache so you must invoke drawLabelCache() to actually do the rendering (unless postlabelcache is set in which case it is drawn right away). Returns MS_SUCCESS or MS_FAILURE on error.

Parameters

imageObj $image

Return Value

int

final int embedScalebar(imageObj $image)

embeds a scalebar. Actually the scalebar is just added to the label cache so you must invoke drawLabelCache() to actually do the rendering (unless postlabelcache is set in which case it is drawn right away).

Returns MS_SUCCESS or MS_FAILURE on error.

Parameters

imageObj $image

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. void freeQuery(layerindex) Frees the query result on a specified layer. If the layerindex is -1, all queries on layers will be freed.

Return Value

void

final string generateSLD()

Returns an SLD XML string based on all the classes found in all the layers that have STATUS on.

Return Value

string

final array getAllGroupNames()

Return an array containing all the group names used in the layers. If there are no groups, it returns an empty array.

Return Value

array

final array getAllLayerNames()

Return an array containing all the layer names.

If there are no layers, it returns an empty array.

Return Value

array

final colorObj getColorbyIndex(int $iCloIndex)

Returns a colorObj corresponding to the color index in the palette.

Parameters

int $iCloIndex

Return Value

colorObj

final string getConfigOption(string $key)

Returns the config value associated with the key.

Returns an empty sting if key not found.

Parameters

string $key

Return Value

string

final labelcacheMemberObj getLabel(int $index)

Returns a labelcacheMemberObj from the map given an index value (0=first label). Labelcache has to be enabled.

.. code-block:: php while ($oLabelCacheMember = $oMap->getLabel($i)) { do something with the labelcachemember ++$i; }

Parameters

int $index

Return Value

labelcacheMemberObj

final layerObj getLayer(int $index)

Returns a layerObj from the map given an index value (0=first layer)

Parameters

int $index

Return Value

layerObj

final layerObj getLayerByName(string $layer_name)

Returns a layerObj from the map given a layer name.

Returns NULL if layer doesn't exist.

Parameters

string $layer_name

Return Value

layerObj

final array getLayersDrawingOrder()

Return an array containing layer's index in the order which they are drawn. If there are no layers, it returns an empty array.

Return Value

array

final array getLayersIndexByGroup(string $groupname)

Return an array containing all the layer's indexes given a group name. If there are no layers, it returns an empty array.

Parameters

string $groupname

Return Value

array

final int getMetaData(string $name)

Fetch metadata entry by name (stored in the :ref:WEB object in the map file). Returns "" if no entry matches the name.

.. note:: getMetaData's query is case sensitive.

Parameters

string $name

Return Value

int

final int getNumSymbols()

Return the number of symbols in map.

Return Value

int

final string getProjection()

Returns a string representation of the projection.

Returns NULL on error or if no projection is set.

Return Value

string

final int getSymbolByName(string $symbol_name)

Returns the symbol index using the name.

Parameters

string $symbol_name

Return Value

int

final symbolObj getSymbolObjectById(int $symbolid)

Returns the symbol object using a symbol id. Refer to the symbol object reference section for more details.

int insertLayer( layerObj layer [, int nIndex=-1 ] ) Insert a copy of layer into the Map at index nIndex. The default value of nIndex is -1, which means the last possible index. Returns the index of the new Layer, or -1 in the case of a failure.

Parameters

int $symbolid

Return Value

symbolObj

final int loadMapContext(string $filename, bool $unique_layer_name)

Available only if WMS support is enabled. Load a :ref:WMS Map Context <map_context> XML file into the current mapObj. If the map already contains some layers then the layers defined in the WMS Map context document are added to the current map. The 2nd argument unique_layer_name is optional and if set to MS_TRUE layers created will have a unique name (unique prefix added to the name). If set to MS_FALSE the layer name will be the the same name as in the context. The default value is MS_FALSE. Returns MS_SUCCESS/MS_FAILURE.

Parameters

string $filename
bool $unique_layer_name

Return Value

int

final int loadOWSParameters(OwsrequestObj $request, string $version)

Load OWS request parameters (BBOX, LAYERS, &c.) into map. Returns MS_SUCCESS or MS_FAILURE. 2nd argument version is not mandatory.

If not given, the version will be set to 1.1.1 int loadQuery(filename) Loads a query from a file. Returns MS_SUCCESS or MS_FAILURE. To be used with savequery.

Parameters

OwsrequestObj $request
string $version

Return Value

int

final int moveLayerDown(int $layerindex)

Move layer down in the hierarchy of drawing.

Returns MS_SUCCESS or MS_FAILURE on error.

Parameters

int $layerindex

Return Value

int

final int moveLayerUp(int $layerindex)

Move layer up in the hierarchy of drawing.

Returns MS_SUCCESS or MS_FAILURE on error.

Parameters

int $layerindex

Return Value

int

final int offsetExtent(float $x, float $y)

Offset the map extent based on the given distances in map coordinates.

Returns MS_SUCCESS or MS_FAILURE.

Parameters

float $x
float $y

Return Value

int

final int owsDispatch(OwsrequestObj $request)

Processes and executes the passed OpenGIS Web Services request on the map. Returns MS_DONE (2) if there is no valid OWS request in the req object, MS_SUCCESS (0) if an OWS request was successfully processed and MS_FAILURE (1) if an OWS request was not successfully processed. OWS requests include :ref:WMS <wms_server>, :ref:WFS <wfs_server>, :ref:WCS <wcs_server> and :ref:SOS <sos_server> requests supported by MapServer.

Results of a dispatched request are written to stdout and can be captured using the msIO services (ie. ms_ioinstallstdouttobuffer() and ms_iogetstdoutbufferstring())

Parameters

OwsrequestObj $request

Return Value

int

final imageObj prepareImage()

Return a blank image object.

Return Value

imageObj

final void prepareQuery()

Calculate the scale of the map and set map->scaledenom.

Return Value

void

final string processLegendTemplate(array $params)

Process legend template files and return the result in a buffer.

.. seealso:: :ref:processtemplate <processtemplate>

Parameters

array $params

Return Value

string

final string processQueryTemplate(array $params, bool $generateimages)

Process query template files and return the result in a buffer.

Second argument generateimages is not mandatory. If not given it will be set to TRUE. .. seealso:: :ref:processtemplate <processtemplate> .. _processtemplate:

Parameters

array $params
bool $generateimages

Return Value

string

final string processTemplate(array $params, bool $generateimages)

Process the template file specified in the web object and return the result in a buffer. The processing consists of opening the template file and replace all the tags found in it. Only tags that have an equivalent element in the map object are replaced (ex [scaledenom]).

The are two exceptions to the previous statement :

  • [img], [scalebar], [ref], [legend] would be replaced with the appropriate url if the parameter generateimages is set to MS_TRUE. (Note : the images corresponding to the different objects are generated if the object is set to MS_ON in the map file)
  • the user can use the params parameter to specify tags and their values. For example if the user have a specific tag call [my_tag] and would like it to be replaced by "value_of_my_tag" he would do .. code-block:: php $tmparray["my_tag"] = "value_of_my_tag"; $map->processtemplate($tmparray, MS_FALSE);

Parameters

array $params
bool $generateimages

Return Value

string

final int queryByFeatures(int $slayer)

Perform a query based on a previous set of results from a layer. At present the results MUST be based on a polygon layer.

Returns MS_SUCCESS if shapes were found or MS_FAILURE if nothing was found or if some other error happened (note that the error message in case nothing was found can be avoided in PHP using the '@' control operator).

Parameters

int $slayer

Return Value

int

final int queryByIndex($layerindex, $tileindex, $shapeindex, $addtoquery)

Add a specific shape on a given layer to the query result.

If addtoquery (which is a non mandatory argument) is set to MS_TRUE, the shape will be added to the existing query list. Default behavior is to free the existing query list and add only the new shape.

Parameters

$layerindex
$tileindex
$shapeindex
$addtoquery

Return Value

int

final int queryByPoint(pointObj $point, int $mode, float $buffer)

Query all selected layers in map at point location specified in georeferenced map coordinates (i.e. not pixels).

The query is performed on all the shapes that are part of a :ref:CLASS that contains a :ref:TEMPLATE value or that match any class in a layer that contains a :ref:LAYER :ref:TEMPLATE <template> value. Mode is MS_SINGLE or MS_MULTIPLE depending on number of results you want. Passing buffer -1 defaults to tolerances set in the map file (in pixels) but you can use a constant buffer (specified in ground units) instead. Returns MS_SUCCESS if shapes were found or MS_FAILURE if nothing was found or if some other error happened (note that the error message in case nothing was found can be avoided in PHP using the '@' control operator).

Parameters

pointObj $point
int $mode
float $buffer

Return Value

int

final int queryByRect(rectObj $rect)

Query all selected layers in map using a rectangle specified in georeferenced map coordinates (i.e. not pixels). The query is performed on all the shapes that are part of a :ref:CLASS that contains a :ref:TEMPLATE value or that match any class in a layer that contains a :ref:LAYER :ref:TEMPLATE <template> value. Returns MS_SUCCESS if shapes were found or MS_FAILURE if nothing was found or if some other error happened (note that the error message in case nothing was found can be avoided in PHP using the '@' control operator).

Parameters

rectObj $rect

Return Value

int

final int queryByShape(shapeObj $shape)

Query all selected layers in map based on a single shape, the shape has to be a polygon at this point.

Returns MS_SUCCESS if shapes were found or MS_FAILURE if nothing was found or if some other error happened (note that the error message in case nothing was found can be avoided in PHP using the '@' control operator).

Parameters

shapeObj $shape

Return Value

int

final layerObj removeLayer(int $nIndex)

Remove a layer from the mapObj. The argument is the index of the layer to be removed. Returns the removed layerObj on success, else null.

Parameters

int $nIndex

Return Value

layerObj

final int removeMetaData(string $name)

Remove a metadata entry for the map (stored in the WEB object in the map file). Returns MS_SUCCESS/MS_FAILURE.

Parameters

string $name

Return Value

int

final int save(string $filename)

Save current map object state to a file. Returns -1 on error.

Use absolute path. If a relative path is used, then it will be relative to the mapfile location.

Parameters

string $filename

Return Value

int

final int saveMapContext(string $filename)

Available only if WMS support is enabled. Save current map object state in :ref:WMS Map Context <map_context> format. Only WMS layers are saved in the WMS Map Context XML file. Returns MS_SUCCESS/MS_FAILURE.

Parameters

string $filename

Return Value

int

final int saveQuery(string $filename, int $results)

Save the current query in a file. Results determines the save format - MS_TRUE (or 1/true) saves the query results (tile index and shape index), MS_FALSE (or 0/false) the query parameters (and the query will be re-run in loadquery). Returns MS_SUCCESS or MS_FAILURE. Either save format can be used with loadquery. See RFC 65 and ticket #3647 for details of different save formats.

Parameters

string $filename
int $results

Return Value

int

final int scaleExtent(float $zoomfactor, float $minscaledenom, float $maxscaledenom)

Scale the map extent using the zoomfactor and ensure the extent within the minscaledenom and maxscaledenom domain. If minscaledenom and/or maxscaledenom is 0 then the parameter is not taken into account. Returns MS_SUCCESS or MS_FAILURE.

Parameters

float $zoomfactor
float $minscaledenom
float $maxscaledenom

Return Value

int

final int selectOutputFormat(string $type)

Selects the output format to be used in the map.

Returns MS_SUCCESS/MS_FAILURE. .. note:: the type used should correspond to one of the output formats declared in the map file. The type argument passed is compared with the mimetype parameter in the output format structure and then to the name parameter in the structure.

Parameters

string $type

Return Value

int

final int appendOutputFormat(outputFormatObj $outputFormat)

Appends outputformat object in the map object.

Returns the new numoutputformats value.

Parameters

outputFormatObj $outputFormat

Return Value

int

final int removeOutputFormat(string $name)

Remove outputformat from the map.

Returns MS_SUCCESS/MS_FAILURE.

Parameters

string $name

Return Value

int

final outputFormatObj getOutputFormat(int $index)

Returns the outputformat at index position.

Parameters

int $index

Return Value

outputFormatObj

final int set(string $property_name, $new_value)

Set map object property to new value.

Parameters

string $property_name
$new_value

Return Value

int

final int setCenter(pointObj $center)

Set the map center to the given map point.

Returns MS_SUCCESS or MS_FAILURE.

Parameters

pointObj $center

Return Value

int

final int setConfigOption(string $key, string $value)

Sets a config parameter using the key and the value passed

Parameters

string $key
string $value

Return Value

int

final void setExtent(float $minx, float $miny, float $maxx, float $maxy)

Set the map extents using the georef extents passed in argument.

Returns MS_SUCCESS or MS_FAILURE on error.

Parameters

float $minx
float $miny
float $maxx
float $maxy

Return Value

void

final int setFontSet(string $fileName)

Load and set a new :ref:fontset.

boolean setLayersDrawingOrder(array layeryindex) Set the layer's order array. The argument passed must be a valid array with all the layer's index. Returns MS_SUCCESS or MS_FAILURE on error.

Parameters

string $fileName

Return Value

int

final int setMetaData(string $name, string $value)

Set a metadata entry for the map (stored in the WEB object in the map file). Returns MS_SUCCESS/MS_FAILURE.

Parameters

string $name
string $value

Return Value

int

final int setProjection(string $proj_params, bool $bSetUnitsAndExtents)

Set map projection and coordinate system. Returns MS_SUCCESS or MS_FAILURE on error.

Parameters are given as a single string of comma-delimited PROJ.4 parameters. The argument : bSetUnitsAndExtents is used to automatically update the map units and extents based on the new projection. Possible values are MS_TRUE and MS_FALSE. By default it is set at MS_FALSE.

Parameters

string $proj_params
bool $bSetUnitsAndExtents

Return Value

int

final int setRotation(float $rotation_angle)

Set map rotation angle. The map view rectangle (specified in EXTENTS) will be rotated by the indicated angle in the counter- clockwise direction. Note that this implies the rendered map will be rotated by the angle in the clockwise direction.

Returns MS_SUCCESS or MS_FAILURE.

Parameters

float $rotation_angle

Return Value

int

final int setSize(int $width, int $height)

Set the map width and height. This method updates the internal geotransform and other data structures required for map rotation so it should be used instead of setting the width and height members directly.

Returns MS_SUCCESS or MS_FAILURE.

Parameters

int $width
int $height

Return Value

int

final int setSymbolSet(string $fileName)

Load and set a symbol file dynamically.

Parameters

string $fileName

Return Value

int

final int setWKTProjection(string $proj_params, bool $bSetUnitsAndExtents)

Same as setProjection(), but takes an OGC WKT projection definition string as input. Returns MS_SUCCESS or MS_FAILURE on error.

.. note:: setWKTProjection requires GDAL support

Parameters

string $proj_params
bool $bSetUnitsAndExtents

Return Value

int

final int zoomPoint(int $nZoomFactor, pointObj $oPixelPos, int $nImageWidth, int $nImageHeight, rectObj $oGeorefExt)

Zoom to a given XY position. Returns MS_SUCCESS or MS_FAILURE on error.

Parameters are

  • Zoom factor : positive values do zoom in, negative values zoom out. Factor of 1 will recenter.
  • Pixel position (pointObj) : x, y coordinates of the click, with (0,0) at the top-left
  • Width : width in pixel of the current image.
  • Height : Height in pixel of the current image.
  • Georef extent (rectObj) : current georef extents.
  • MaxGeoref extent (rectObj) : (optional) maximum georef extents. If provided then it will be impossible to zoom/pan outside of those extents.

Parameters

int $nZoomFactor
pointObj $oPixelPos
int $nImageWidth
int $nImageHeight
rectObj $oGeorefExt

Return Value

int

final int zoomRectangle(rectObj $oPixelExt, int $nImageWidth, int $nImageHeight, rectObj $oGeorefExt)

Set the map extents to a given extents. Returns MS_SUCCESS or MS_FAILURE on error.

Parameters are :

  • oPixelExt (rect object) : Pixel Extents
  • Width : width in pixel of the current image.
  • Height : Height in pixel of the current image.
  • Georef extent (rectObj) : current georef extents.

Parameters

rectObj $oPixelExt
int $nImageWidth
int $nImageHeight
rectObj $oGeorefExt

Return Value

int

final int zoomScale(float $nScaleDenom, pointObj $oPixelPos, int $nImageWidth, int $nImageHeight, rectObj $oGeorefExt, rectObj $oMaxGeorefExt)

Zoom in or out to a given XY position so that the map is displayed at specified scale. Returns MS_SUCCESS or MS_FAILURE on error.

Parameters are :

  • ScaleDenom : Scale denominator of the scale at which the map should be displayed.
  • Pixel position (pointObj) : x, y coordinates of the click, with (0,0) at the top-left
  • Width : width in pixel of the current image.
  • Height : Height in pixel of the current image.
  • Georef extent (rectObj) : current georef extents.
  • MaxGeoref extent (rectObj) : (optional) maximum georef extents. If provided then it will be impossible to zoom/pan outside of those extents.

Parameters

float $nScaleDenom
pointObj $oPixelPos
int $nImageWidth
int $nImageHeight
rectObj $oGeorefExt
rectObj $oMaxGeorefExt

Return Value

int