PHP MapScript    Home  |  Docs  |  Support  |  Bugs  |  CVS  |  Downloads

MapTools.org

PHP MapScript Version 3.6 Documentation

See also: * the Perl MapScript documentation: http://mapserver.gis.umn.edu/doc36/perlmapscript-reference.html * the MapServer Map File documentation: http://mapserver.gis.umn.edu/doc36/mapfile-reference.html * and the rest of the MapServer 3.6 documentation: http://mapserver.gis.umn.edu/doc36/ Very important notes: --------------------- - Constant names and class member variable names are case-sensitive in PHP. - Several MapScript functions (all those that access files in the back end such as ms_newMapObj(), drawMap(), etc) will affect the value of the current working directory (CWD) in the PHP environment. This will be fixed eventually but in the meantime you should be careful about these side-effects. Constants: ---------- 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 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 Output Image Types: MS_GIF, MS_PNG, MS_JPEG, MS_WBMP Functions: ---------- string ms_GetVersion() Returns the MapServer version and options in a string. This string can be parsed to find out which modules were compiled in, etc. array ms_TokenizeMap(string map_file_name) Preparses a mapfile through the MapServer parser and return an array with one item for each token from the mapfile. Strings, logical expressions, regex expressions and comments are returned as individual tokens. MapObj Class: ------------- Constructor: mapObj ms_newMapObj(string map_file_name [, string new_map_path]) Returns a new object to deal with a MapServer map file. 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 relative paths inside the mapfile. Members: int numlayers (read-only) string name int status int width int height int transparent int interlace int imagetype int imagequality int resolution (pixels per inch, defaults to 72) rectObj extent; double cellsize int units (map units type) double scale (read-only, set by drawMap()) string shapepath int keysizex int keysizey int keyspacingx int keyspacingy webObj web referenceMapObj reference colorObj imagecolor scalebarObj scalebar legendObj legend string symbolsetfilename (read-only, set by setSymbolSet()) string fontsetfilename (read-only, set by setFontSet()) Methods: int set(string property_name, new_value) Set map object property to new value. Returns -1 on error. int addColor(int r, int g, int b) Add a color to map's palette. Returns color index. int getsymbolbyname(string symbol_name) Returns the symbol index using the name. void preparequery() Calculate the scale of the map and assign it to the map->scale. imageObj prepareImage() Return handle on blank image object. imageObj draw() Render map and return handle on image object. imageObj drawQuery() Render a query map and return handle on image object. imageObj drawLegend() Render legend and return handle on image object. imageObj drawReferenceMap() Render reference map and return handle on image object. imageObj drawScaleBar() Render scale bar and return handle on 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). 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). int drawLabelCache(imageObj image) Renders the labels for a map. Returns -1 on error. layerObj getLayer(int index) Returns a layerObj from the map given an index value (0=first layer) layerObj getLayerByName(string layer_name) Returns a layerObj from the map given a layer name. colorObj getcolorbyindex(int iCloIndex) Returns a colorObj corresponding to the color index in the palette void setextent(double minx, double miny, double maxx, double maxy) Set the map extents using the georef extents passed in argument. void zoompoint(int nZoomFactor, pointObj oPixelPos, int nImageWidth, int nImageHeight, rectObj oGeorefExt) Zoom to a given XY postion; Parmeters 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. void zoomrectange(rectObj oPixelExt, int nImageWidth, int nImageHeight, rectObj oGeorefExt) Set the map extents to a given extents. Parmeters are : - Pixel Extents, 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. void zoomscale(int nScale, pointObj oPixelPos, int nImageWidth, int nImageHeight, rectObj oGeorefExt) Zoom in or out to a given XY postion so that the map is displayed at specified scale. Parmeters are : - Scale : 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. int queryByPoint(pointObj point, int mode, double 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 CLASS that contains a TEMPLATE value or that match any class in a layer that contains a LAYER TEMPLATE value. Mode is MS_SINGLE or MS_MULTIPLE depending on number of results you want. Passing buffer <=0 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). 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 CLASS that contains a TEMPLATE value or that match any class in a layer that contains a LAYER 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. 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 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). int save(string filename) Save current map object state to a file. Returns -1 on error. char getProjection() Returns a string represenation of the projection. If no projection is set, MS_FALSE is returned. int setProjection(string proj_params, boolean bSetUnitsAndExtents) Set map projection and coordinate system. 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 defualt it is set at MS_FALSE int getMetaData(string name) Fetch metadata entry by name (stored in the WEB object in the map file). Returns "" if no entry matches the name. Note that the search is case sensitive. 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. array getLayersIndexByGroup(string groupname) Return an array containing all the layer's indexes given a group name. array getAllGroupNames() Return an array containing all the group names used in the layers. array getAllLayerNames() Return an array containing all the layer names. boolean moveLayerUp(int layerindex) Move layer up in the hierarcy of drawing. boolean moveLayerDown(int layerindex) Move layer down in the hierarcy of drawing. array getlayersdrawingorder() Return an array containing layer's index in the order which they are drawn. boolean setlayersdrawingorder(array layeryindex) Set the layer's order array. The argument passed must be a valid array with all the layer's index. Return TRUE on success or else FALSE. char *processtemplate(array params, boolean generateimages) Process the template file specified in the web object and return the resut 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 [scale]). The are two expetions 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 diffrent objects are geneterated 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 : $tmparray["my_tag"] = "value_of_my_tag"; $map->processtemplate($tmparray, MS_FASLE); char *processquerytemplate(array params) Process query template files and return the resut in a buffer. See also : processtemplate function. char *processlegendtemplate(array params) Process legend template files and return the resut in a buffer. See also : processtemplate function. int setSymbolSet(string fileName) Load and set a symbol file dynamically. int getNumSymbols() Return the number of symbols in map. int setFontSet(string fileName) Load and set a new fontset. LayerObj Class: --------------- Constructor: Layer Objects can be returned by the MapObj class, or can be created using: layerObj ms_newLayerObj(MapObj map) Members: int numclasses (read-only) int index (read-only) int status (MS_ON, MS_OFF, MS_DEFAULT or MS_DELETE) string classitem string name string group string data int type double tolerance int toleranceunits double symbolscale double minscale double maxscale double labelminscale double labelmaxscale int maxfeatures int offsite int annotate int transform int labelcache int postlabelcache string labelitem string labelsizeitem string labelangleitem string tileitem string tileindex string header string footer string connection int connectiontype string filteritem string template Methods: int set(string property_name, new_value) Set object property to a new value. Returns -1 on error. int draw(imageObj image) Draw a single layer, add labels to cache if required. Returns -1 on error. int drawQuery(imageObj image) Draw query map for a single layer. classObj getClass(int classIndex) Returns a classObj from the layer given an index value (0=first class) int queryByPoint(pointObj point, int mode, double buffer) Query layer 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 CLASS that contains a TEMPLATE value or that match any class in a layer that contains a LAYER TEMPLATE value. Mode is MS_SINGLE or MS_MULTIPLE depending on number of results you want. Passing buffer <=0 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). int queryByRect(rectObj rect) Query layer 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 CLASS that contains a TEMPLATE value or that match any class in a layer that contains a LAYER 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 layer 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). int queryByFeatures(int slayer) Perform a query set based on a previous set of results from another 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). int queryByAttributes(int mode) Query layer for shapes that intersect current map extents. The query is performed on all the shapes that are part of a CLASS that contains a TEMPLATE value or that match any class in a layer that contains a LAYER TEMPLATE value. Mode is MS_SINGLE or MS_MULTIPLE depending on number of results you want. 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 setFilter(string expression) Set layer filter expression. char getProjection() Returns a string represenation of the projection. If no projection is set, MS_FALSE is returned. int setProjection(string proj_params) Set layer projection and coordinate system. Parameters are given as a single string of comma-delimited PROJ.4 parameters. int getNumResult() Returns the number of results from this layer in the last query. resultCacheMemberObj getResult(int index) Returns a resultCacheMemberObj by index from a layer object with index in the range 0 to numresults-1. Returns a valid object or FALSE(0) if index is invalid. int open(string shapepath) Open the layer for use with getShape(). Returns MS_SUCCESS/MS_FAILURE. void close() Close layer previously opened with open(). shapeObj getShape(int tileindex, int shapeindex) Retrieve shapeObj from a layer by index. Tileindex is used only for tiled shapefiles (you get it from the resultCacheMemberObj returned by getResult() for instance). Simply pass tileindex = -1 for other data sources. int addFeature(shapeObj shape) Add a new feature in a layer. Returns -1 on error. int getMetaData(string name) Fetch layer metadata entry by name. Returns "" if no entry matches the name. Note that the search is case sensitive. int setMetaData(string name, string value) Set a metadata entry for the layer. Returns MS_SUCCESS/MS_FAILURE. int getWMSFeatureInfoURL(int clickX, int clickY, int featureCount, string infoFormat) Return a WMS GetFeatureInfo URL (works only for WMS layers) clickX, clickY is the location of to query in pixel coordinates with (0,0) at the top left of the image. featureCount is the number of results to return. infoFormat is the format the format in which the result should be requested. Depends on remote server's capabilities. MapServer WMS servers support only "MIME" (and should support "GML.1" soon). Returns "" and outputs a warning if layer is not a WMS layer or if it is not queriable. char ** getItems() return a list of items. Must call open function first. ClassObj Class: --------------- Constructor: Class Objects can be returned by the LayerObj class, or can be created using: classObj ms_newClassObj(layerObj layer) Members: string name int type int status (MS_ON, MS_OFF or MS_DELETE) int color int backgroundcolor int outlinecolor int overlaycolor int overlaybackgroundcolor int overlayoutlinecolor int symbol string symbolname int size int minsize int maxsize int overlaysymbol string overlaysymbolname int overlaysize int overlayminsize int overlaymaxsize labelObj label Methods: int set(string property_name, new_value) Set object property to a new value. Returns -1 on error. int setexpression(string expression) Set the expression string for the class object. int settext(string text) Set the text string for the class object. int drawLegendIcon(int width, int height, imageObj im, int dstX, int dstY) Draw the legend icon on im object at dstX, dstY. Returns MS_SUCCESS/MS_FAILURE. imageObj createLegendIcon(int width, int height) Draw the legend icon and return a new imageObj. ImageObj Class: --------------- Constructor: Instances of ImageObj are always created by the map class methods. Members: int width (read-only) int height (read-only) string imagepath string imageurl Methods: void free() Destroys resources used by an image object. int saveImage(string filename, int type, int transparent, int interlace, int quality) Writes image object to specifed filename. Passing an empty filename sends output to stdout. In this case, the PHP header() function should be used to set the documents's content-type prior to calling saveImage(). Type can be either MS_GIF, MS_PNG, MS_JPEG or MS_WBMP (depends on which version of GD was used to compile MapScript) Quality should be a value in the range 0-95, higher value implies higher image quality and larger image sizes. If quality is negative, then the default IJG JPEG quality value is used (the quality value is ignored for all formats other than JPEG). The function returns -1 on error. On success, it returns either 0 if writing to an external file, or the number of bytes written if output is sent to stdout. string saveWebImage(int type, int transparent, int interlace, int quality) Writes image to temp directory. Returns image URL. Type can be either MS_GIF, MS_PNG, MS_JPEG or MS_WBMP (depends on which version of GD was used to compile MapScript) Quality should be a value in the range 0-95, higher value implies higher image quality and larger image sizes. If quality is negative, then the default IJG JPEG quality value is used (the quality value is ignored for all formats other than JPEG). void pasteImage(imageObj srcImg, int transparentColorIndex [, int dstX, dstY]) Copy srcImg on top of the current imageObj. transparentColorIndex is the color from srcImg that should be considered transparent (i.e. those pixels won't be copied). Pass -1 if you don't want any transparent color. If optional dstx,dsty are provided then it defines the position where the image should be copied (dstx,dsty = top-left corner position). LabelObj Class: --------------- Constructor: LabelObj are always embedded inside other classes. Members: string font int type int color int outlinecolor int shadowcolor int shadowsizex int shadowsizey int backgroundcolor int backgroundshadowcolor int backgroundshadowsizex int backgroundshadowsizey int size int minsize int maxsize int position int offsetx int offsety double angle int autoangle int buffer int antialias int wrap int minfeaturesize int autominfeaturesize int mindistance int partials int force Methods: int set(string property_name, new_value) Set object property to a new value. Returns -1 on error. webObj Class ----------- Constructor: Instances of webObjare always are always embedded inside the mapObj. Members: string log; string imagepath string template string imageurl string header string footer string empty (read-only) string error (read-only) string mintemplate string maxtemplate double minscale double maxscale rectObj extent (read-only) Methods: int set(string property_name, new_value) Set object property to a new value. Returns -1 on error. referenceMapObj Class -------------------- Constructor: Instances of referenceMapObj are always embedded inside the mapObj. Members: string image int width int height int status rectObj extent (read-only) ColorObj color (read-only) ColorObj outlinecolor (read-only) Method : int set(string property_name, new_value) Set object property to a new value. Returns -1 on error. ColorObj Class: --------------- Constructor: Instances of ColorObj are always embedded inside other classes. Members: int red int green int blue Methods: void setRGB(int red, int green, int blue) Set red, green, blue values. PointObj Class: --------------- Constructor: PointObj ms_newPointObj() Members: double x double y double m //used for measured shape files. set to 0 for other types. Methods: int setXY(double x, double y, double m) Set X,Y coordinate values. Note : the 3rd parameter m is used for measured shape files. It is not mandatory. int draw(mapObj map, layerObj layer, imageObj img, int class_index, string text) Draws the individual point using layer. The class_index is used to classify the point based on the classes defined for the layer. The text string is used to annotate the point. Returns MS_SUCCESS/MS_FAILUREr. double distanceToPoint(pointObj poPoint) Calculates distance between two points. double distanceToLine(pointObject p1, pointObject p2) Calculates distance between a point ad a lined defined by the two points passed in argument. double distanceToShape(shapeObj shape) Calculates the minimum distance between a point and a shape. projectionObj project(projectionObj in, projectionObj out) Project the point from "in" projection (1st argument) to "out" projection (2nd argument). void free() Releases all resources used by the object. LineObj Class: -------------- Constructor: LineObj ms_newLineObj() Members: int numpoints (read-only) Methods: int add(pointObj point) Add a point to the end of line. int addXY(double x, double y, double m) Add a point to the end of line. Note : the 3rd parameter m is used for measured shape files. It is not mandatory. PointObj point(int i) Returns a reference to point number i. Reference is valid only during the life of the lineObj that contains the point. projectionObj project(projectionObj in, projectionObj out) Project the line from "in" projection (1st argument) to "out" projection (2nd argument). void free() Destroys resources used by a line object. ShapeObj Class: -------------- Constructor: ShapeObj ms_newShapeObj(int type) 'type' is one of MS_SHAPE_POINT, MS_SHAPE_LINE, MS_SHAPE_POLYGON or MS_SHAPE_NULL Members: string text int classindex int type (read-only) int numlines (read-only) int index (read-only) int tileindex (read-only) rectObj bounds (read-only) int numvalues (read-only) array values (read-only) The values array is an associative array with the attribute values for this shape. It is set only on shapes obtained from layer->getShape(). The key to the values in the array is the attribute name, e.g. $population = $shape->values["Population"]; Methods: int set(string property_name, new_value) Set object property to a new value. Returns -1 on error. int add(lineObj line) Add a line (i.e. a part) to the shape. LineObj line(int i) Returns a reference to line number i. Reference is valid only during the life of the shapeObj that contains the point. int draw(mapObj map, layerObj layer, imageObj img, int class_index, string text) Draws the individual shape using layer. The class_index is used to classify the shape based on the classes defined for the layer. The text string is used to annotate the shape. Returns MS_SUCCESS/MS_FAILURE. boolean contains(pointObj point) Returns MS_TRUE if the point is inside the shape, MS_FALSE otherwise. boolean intersects(shapeObj shape) Returns MS_TRUE if the two shapes intersect, MS_FALSE otherwise. projectionObj project(projectionObj in, projectionObj out) Project the shape from "in" projection (1st argument) to "out" projection (2nd argument). pointObj getpointusingmeasure(double m) Apply only on Measured shape files. Given a measure m, retun the corresponding XY location on the shapeobject. pointObj getmeasureusingpoint(pointObject point) Apply only on Measured shape files. Given an XY Location, find the nearest point on the shape object. Return a point object of this point with the m value set. void free() Destroys resources used by a shape object. RectObj Class: -------------- Constructor: RectObj are sometimes embedded inside other objects. New ones can also be created with: RectObj ms_newRectObj() Members: double minx double miny double maxx double maxy Methods: int set(string property_name, new_value) Set object property to a new value. Returns -1 on error. void setextent(double minx, double miny, double maxx, double maxy) Set the rectangle extents. int draw(mapObj map, layerObj layer, imageObj img, int class_index, string text) Draws the individual rectangle using layer. The class_index is used to classify the rectangle based on the classes defined for the layer. The text string is used to annotate the rectangle. Returns MS_SUCCESS/MS_FAILURE. double fit(int width, int height) Adjust extents of the rectangle to fit the width/height specified. projectionObj project(projectionObj in, projectionObj out) Project the rectangle from "in" projection (1st argument) to "out" projection (2nd argument). void free() Destroys resources used by a rect object. ShapefileObj Class: ------------------- Constructor: shapefileObj ms_newShapefileObj(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). Members: int numshapes (read-only) int type (read-only) string source (read-only) rectObj bounds (read-only) Methods: shapeObj getShape(int i) Retrieve shape by index. shapeObj getPoint(int i) Retrieve point by index. shapeObj getTransformed(mapObj map, int i) Retrieve shape by index. rectObj getExtent(int i) Retrieve a shape's bounding box by index. int addShape(shapeObj shape) Appends a shape to an open shapefile. int addPoint(pointObj point) Appends a point to an open shapefile. void free() Closes a shape file (and commits all changes in write mode) and releases all resources used by the object. ResultCacheMemberObj Class: --------------------------- Constructor: Instances of ResultCacheMemberObj are always obtained through layerObj's getResult() method. Members: int shapeindex (read-only) int tileindex (read-only) int classindex (read-only) ProjectionObj class: ------------------- Constructor: ProjectionObj 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); scalebarObj Class ----------- Constructor: Instances of scalebarObj are always are always embedded inside the mapObj. Members: int height; int width; int style; int intervals; int color; int backgroundcolor; int outlinecolor; int units; int status; //MS_ON, MS_OFF, MS_EMBED int position; //for embeded scalebars, MS_UL, MS_UC, ... int transparent; int interlace; int postlabelcache; labelObj label; colorObj imagecolor; Methods: int set(string property_name, new_value) Set object property to a new value. Returns -1 on error. int setimagecolor(int red, int green, int blue) Sets the imagecolor propery (baclground) of the object. Returns false on error. legendObj Class ----------- Constructor: Instances of legendObj are always are always embedded inside the mapObj. Members: int height; int width; int keysizex; int keysizey; int keyspacingx; int keyspacingy; int outlinecolor; //Color of outline of box, -1 for no outline int status; //MS_ON, MS_OFF, MS_EMBED int position; //for embeded legends, MS_UL, MS_UC, ... int transparent; int interlace; int postlabelcache; //MS_TRUE, MS_FALSE labelObj label; colorObj imagecolor; string template Methods: int set(string property_name, new_value) Set object property to a new value. Returns -1 on error.

Printer Friendly

 

Docs

PHP MapScript 4.6

PHP MapScript 4.4

PHP MapScript 4.2

PHP MapScript 4.0

PHP MapScript 3.5

PHP MapScript 3.4

Licensing

 

Related Links

MapServer Home

MapServer Wiki

MapServer Docs

 

Contact Information

MapServer Users List