Abstract
This document describes all of the classes, properties and methods associated with the PHP/Mapscript module.
Last Updated: 06/04/2003
Table of Contents
The module has been tested and used on Linux, Solaris, *BSD, and WinNT.
This module is constantly under development.
The main resource for help is the PHP/MapScript web page at: http://www2.dmsolutions.on.ca/mapserver/php_mapscript/.
See also the MapServer Wiki for links to more information on this module: http://mapserver.gis.umn.edu/cgi-bin/wiki.pl?PHPMapScript
For installation questions regarding the PHP/Mapscript module, see the PHP/Mapscript Installation HOWTO.
Also, see the Mapserver MapScript documentation at: http://mapserver.gis.umn.edu/doc/perlmapscript-reference.html and the MapServer MapFile documentation at: http://mapserver.gis.umn.edu/doc/mapfile-reference.html.
The main PHP site for documentation is at: http://www.php.net/ .
The following Mapserver constants are available:
Boolean values: MS_TRUE, MS_FALSE, MS_ON, MS_OFF, MS_YES, MS_NO Map units: MS_INCHES, MS_FEET, MS_MILES, MS_METERS, MS_KILOMETERS, MS_DD, MS_PIXELS Layer types: MS_LAYER_POINT, MS_LAYER_LINE, MS_LAYER_POLYGON, MS_LAYER_RASTER, MS_LAYER_ANNOTATION, MS_LAYER_QUERY, MS_LAYER_CIRCLE MS_LAYER_GRATICULE Layer/Legend/Scalebar/Class Status: MS_ON, MS_OFF, MS_DEFAULT, MS_EMBED, MS_DELETE Font types: MS_TRUETYPE, MS_BITMAP Label positions: MS_UL, MS_LR, MS_UR, MS_LL, MS_CR, MS_CL, MS_UC, MS_LC, MS_CC, MS_AUTO, MS_XY Bitmap font styles: MS_TINY , MS_SMALL, MS_MEDIUM, MS_LARGE, MS_GIANT Shape types: MS_SHAPE_POINT, MS_SHAPE_LINE, MS_SHAPE_POLYGON, MS_SHAPE_NULL Shapefile types: MS_SHP_POINT, MS_SHP_ARC, MS_SHP_POLYGON, MS_SHP_MULTIPOINT Query/join types: MS_SINGLE, MS_MULTIPLE Querymap styles: MS_NORMAL, MS_HILITE, MS_SELECTED Connection Types: MS_INLINE, MS_SHAPEFILE, MS_TILED_SHAPEFILE, MS_SDE, MS_OGR, MS_TILED_OGR, MS_POSTGIS, MS_WMS, MS_ORACLESPATIAL Error codes: MS_NOERR, MS_IOERR, MS_MEMERR, MS_TYPEERR, MS_SYMERR, MS_REGEXERR, MS_TTFERR, MS_DBFERR, MS_GDERR, MS_IDENTERR, MS_EOFERR, MS_PROJERR, MS_MISCERR, MS_CGIERR, MS_WEBERR, MS_IMGERR, MS_HASHERR, MS_JOINERR, MS_NOTFOUND, MS_SHPERR, MS_PARSEERR, MS_SDEERR, MS_OGRERR, MS_QUERYERR, MS_WMSERR, MS_WMSCONNERR, MS_ORACLESPATIALERR, MS_WFSERR, MS_WFSCONNERR, MS_MAPCONTEXTERR, MS_HTTPERR
The grid is always embedded inside a layer object defined as a grid (layer->connectiontype = MS_GRATICULE) (for more docs : http://mapserver.gis.umn.edu/cgi-bin/wiki.pl?MapServerGrid) A layer can become a grid layer by adding a grid object to it using : ms_newGridObj(layerObj layer) Example : $oLayer = ms_newlayerobj($oMap); $oLayer->set("name", "GRID"); ms_newgridobj($oLayer); $oLayer->grid->set("labelformat", "DDMMSS");
shapefileObj ms_newprojectionobj(string projectionstring)
Creates a projection object based on the projection string passed as argument.
Eg : $projInObj = ms_newprojectionobj("proj=latlong") will create a geographic projection class.
Eg of usage : the following example will convert a lat/long point to an LCC projection :
$projInObj = ms_newprojectionobj("proj=latlong"); $projOutObj = ms_newprojectionobj("proj=lcc,ellps=GRS80, lat_0=49,lon_0=-95,lat_1=49,lat_2=77"); $poPoint = ms_newpointobj(); $poPoint->setXY(-92.0, 62.0); $poPoint = $poPoint->project($projInObj, $projOutObj);
Q:. | How do I change the colour of a shape on-the-fly? |
A:. | Say you have an image object that you are trying to draw more objects on: $imageObj = $mapObj->draw(); $pointObj->draw($mapObj, $layerObj, $imageObj, 0, $label); Fine. However, you want to change the colour of the point on the fly before you draw it: $imageObj = $mapObj->draw(); $classObj = $layerObj->getClass(0); $newColour = $mapObj->addColor(255,0,0); $classObj->set('color', $newColour); $pointObj->draw($mapObj, $layerObj, $imageObj, 0, $label); This won't work. In order to get the result you want, you must call $mapObj->draw(); after you add your colour to the palatte. |