An instance of classObj is associated with with one instance of layerObj.
+-------+ 0..* 1 +-------+
| Class | <--------> | Layer |
+-------+ +-------+
The other important associations for classObj are with styleObj and
labelObj.
+-------+ 1 0..* +-------+
| Class | ---------> | Style |
+-------+ +-------+
+-------+ 1 0..1 +-------+
| Class | ---------> | Label |
+-------+ +-------+
Multiple class styles are now supported in 4.1. See the styleObj section
for details on use of multiple class styles.
- debug : int
- MS_TRUE or MS_FALSE
- keyimage : string
- TODO Not sure what this attribute is for
- label : labelObj
- Definition of class labeling
- layer : layerObj immutable
- Reference to the parent layer
- maxscale : float
- The maximum scale at which class is drawn
- minscale : float
- The minimum scale at which class is drawn
- name : string
- Unique within a layer
- numstyles : int
- Number of styles for class. In the future, probably the 4.4 release,
this attribute will be made immutable.
- status : int
- MS_ON or MS_OFF. Draw features of this class or do not.
- template : string
- Template for queries
- title : string
- Text used for legend labeling
- type : int
- The layer type of its parent layer
- new classObj( layerObj parent_layer ) : classObj
- Create a new child classObj instance at the tail (highest index) of
the class array of the parent_layer.
- createLegendIcon( mapObj map, layerObj layer, int width, int height ) : imageObj
- Draw and return a new legend icon.
- drawLegendIcon( mapObj map, layerObj layer, int width, int height, imageObj image, int dstx, int dsty ) : int
- Draw the legend icon onto image at dstx, dsty. Returns
MS_SUCCESS or MS_FAILURE.
- getExpressionString( ) : string
- Return a string representation of the expression enclosed in the quote
characters appropriate to the expression type.
- getFirstMetaDataKey( ) : string
- Returns the first key in the metadata hash table. With
getNextMetaDataKey( ), provides an opaque iterator over keys.
- getMetaData( string key ) : string
- Return the value of the classObj metadata at key.
- getNextMetaDataKey( string lastkey ) : string
- Returns the next key in the metadata hash table or NULL if
lastkey is the last valid key. If lastkey is NULL, returns the
first key of the metadata hash table.
- getStyle( int index ) : styleObj
Return a reference to the styleObj at index in the styles array.
See the styleObj section for more details on multiple class styles.
- insertStyle( styleObj style [, int index=-1 ] ) : int
- Insert a copy of style into the styles array at index index.
Default is -1, or the end of the array. Returns the index at which the
style was inserted.
- moveStyleDown( int index ) : int
- Swap the styleObj at index with the styleObj index + 1.
- moveStyleUp( int index ) : int
- Swap the styleObj at index with the styleObj index - 1.
- removeStyle( int index ) : styleObj
- Remove the styleObj at index from the styles array and return a
copy.
- setExpression( string expression ) : int
- Set expression string where expression is a MapServer regular, logical
or string expression. Returns MS_SUCCESS or MS_FAILUIRE.
- setMetaData( string key, string value ) : int
- Insert value into the classObj metadata at key. Returns MS_SUCCESS
or MS_FAILURE.
Since the 4.0 release, MapServer colors are instances of colorObj. A colorObj
may be a lone object or an attribute of other objects and have no other
associations.
- blue : int
- Blue component of color in range [0-255]
- green : int
- Green component of color in range [0-255]
- red : int
- Red component of color in range [0-255]
- pen : int
- TODO trigger for change in mapserver pens?
Note
Because of the issue with
pen, setting colors by individual
components is unreliable. Best practice is to use setRGB(), setHex(),
or assign to a new instance of colorObj().
- new colorObj( [ int red=0, int green=0, int blue=0 ] ) : colorObj
- Create a new instance. The color arguments are optional.
- setRGB( int red, int green, int blue ) : int
- Set all three RGB components. Returns MS_SUCCESS or MS_FAILURE.
- setHex( string hexcolor ) : int
- Set the color to values specified in case-independent hexadecimal
notation. Calling setHex('#ffffff') assigns values of 255 to each
color component. Returns MS_SUCCESS or MS_FAILURE.
- toHex( ) : string
- Compliments setHex, returning a hexadecimal representation of the
color components.
Provides access to module errors. Has no associations with other
classes.
See http://mapserver.gis.umn.edu/bugs/long_list.cgi?buglist=346 for a usage
example.
- code : int
- A MapServer error code such as MS_IOERR (1), MS_MEMERR (2), etc.
- message : string
- Detailed error message.
- routine : string
- The name of the MapServer function in which the error occurs.
- new errorObj( ) : errorObj
- Return an instance of errorObj used as a starting point for accessing
the mapscript error stack.
- next( ) : errorObj
- Return the next errorObj in the module's error stack.
A fontSetObj is always an attribute of a mapObj.
- filename : string immutable
- Path to the fontset file on disk.
- numfonts : int immutable
- Number of fonts in set.
- getFirstFont( ) : string
- Return the name of the first font in the fonts hash table. Along with
getNextFont( ), provides an opaque iterator for fonts.
- getNextFont( string lastfont ) : string
- Returns the next font following lastfont in the fonts hash table or
NULL if lastfont is the last non-NULL key. If lastfont is NULL,
returns the first key of the fonts hash table.
A graticuleObj is always an attribute of a layerObj and has no other
associations.
An image object is a wrapper for GD and GDAL images.
- format : outputFormatObj
- Image format.
- height : int immutable
- Image height in pixels.
- imagepath : string immutable
- If image is drawn by mapObj.draw( ), this is the mapObj's web.imagepath.
- imageurl : string immutable
- If image is drawn by mapObj.draw( ), this is the mapObj's web.imageurl.
- renderer : int
- MS_RENDER_WITH_GD, MS_RENDER_WITH_SWF, MS_RENDER_WITH_RAWDATA,
MS_RENDER_WITH_PDF, or MS_RENDER_WITH_IMAGEMAP
- size : int
- I don't see where this is used. Anyone?
- width : int immutable
- Image width in pixels.
- new imageObj( int width, int height [, string driver=NULL [, string filename=NULL ] ] ) : imageObj
- Create new instance of imageObj. If filename is specified, an imageObj
is created from the file and any specified width, height, and
driver parameters will be overridden by values of the image in
filename. Otherwise, if driver is specified an imageObj is created
using that driver. See the driver attribute above for details. If
filename is not specified, then width and height should be specified.
- free( ) : void
- In MapServer 4.2 this method does nothing, in 4.3 it is removed from
the module entirely.
- save( string filename [, mapObj parent_map=NULL ] ) : int
- Save image to filename. The optional parent_map parameter must be
specified if saving GeoTIFF images.
Note
The free( ) method of imageObj has been deprecated. In MapServer
revisions 4+ all instances of imageObj will be properly disposed of by
the interpreter's garabage collector. If the application can't wait
for garabage collection, then the instance can simply be deleted or
undef'd.
A labelObj is associated with a classObj, a scalebarObj, or a legendObj.
+-------+ 0..1 1 +----------+
| Label | <--------- | Class |
+-------+ | -------- |
| Scalebar |
| -------- |
| Legend |
+----------+
- angle : float
- TODO
- antialias : int
- MS_TRUE or MS_FALSE
- autoangle : int
- MS_TRUE or MS_FALSE
- autominfeaturesize: int
- MS_TRUE or MS_FALSE
- backgroundcolor : colorObj
- Color of background rectangle or billboard.
- backgroundshadowcolor : colorObj
- Color of background rectangle or billboard shadow.
- backgroundshadowsizex : int
- Horizontal offset of drop shadow in pixels.
- backgroundshadowsizey : int
- Vertical offset of drop shadow in pixels.
- buffer : int
- Maybe this should've been named 'padding' since that's what it is:
padding in pixels around a label.
- color : colorObj
- Foreground color.
- font : string
- Name of TrueType font.
- force : int
- MS_TRUE or MS_FALSE.
- maxsize : int
- Maximum height in pixels for scaled labels. See symbolscale attribute
of layerObj.
- mindistance : int
- Minimum distance in pixels between duplicate labels.
- minfeaturesize : int
- Features of this size of greater will be labeled.
- minsize : int
- Minimum height in pixels.
- offsetx : int
- Horizontal offset of label.
- offsety : int
- Vertical offset of label.
- outlinecolor : colorObj
- Color of one point outline.
- partials : int
- MS_TRUE (default) or MS_FALSE. Whether or not labels can flow past
the map edges.
- postion : int
- MS_UL, MS_UC, MS_UR, MS_CL, MS_CC, MS_CR, MS_LL, MS_LC, MS_LR, or
MS_AUTO.
- shadowcolor : colorObj
- Color of drop shadow.
- shadowsizex : int
- Horizontal offset of drop shadow in pixels.
- shadowsizey : int
- Vertical offset of drop shadow in pixels.
- size : int
- Annotation height in pixels.
- type : int
- MS_BITMAP or MS_TRUETYPE.
- wrap : string
- Character on which legend text will be broken to make multi-line
legends.
An individual feature label. The labelCacheMemberObj class is associated
with labelCacheObj.
+------------------+ 0..* 1 +------------+
| LabelCacheMember | <--------- | LabelCache |
+------------------+ +------------+
- classindex : int immutable
- Index of the class of the labeled feature.
- featuresize : float immutable
- TODO
- label : labelObj immutable
- Copied from the class of the labeled feature.
- layerindex : int immutable
- The index of the layer of the labeled feature.
- numstyles : int immutable
- Number of styles as for the class of the labeled feature.
- point : pointObj immutable
- Label point.
- poly : shapeObj immutable
- Label bounding box.
- shapeindex : int immutable
- Index within shapefile of the labeled feature.
- status : int immutable
- Has the label been drawn or not?
- string : string immutable
- Label text.
- styles : styleObj immutable
- TODO this should be protected from SWIG.
- tileindex : int immutable
- Tileindex of the layer of the labeled feature.
None.
Note
No real scripting control over labeling currently, but there may be
some interesting new possibilities if users have control over labeling
text, position, and status.
Set of a map's cached labels. Has no other existence other than as an
attribute of a mapObj. Associated with labelCacheMemberObj and
markerCacheMemberObj.
+------------+ 1 0..* +-------------------+
| LabelCache | ---------> | LabelCacheMember |
+------------+ + ----------------- +
| MarkerCacheMember |
+-------------------+
- cachesize : int immutable
- TODO
- markercachesize : int immutable
- TODO
- numlabels : int immutable
- Number of label members.
- nummarkers : int immutable
- Number of marker members.
- freeCache( ) : void
- Free the labelcache.
A layerObj is associated with one mapObj and has no other existence .
+-------+ 0..* 1 +-----+
| Layer | <--------> | Map |
+-------+ +-----+
The other important association for layerObj is with classObj
+-------+ 1 0..* +-------+
| Layer | <--------> | Class |
+-------+ +-------+
- classitem : string
- The attribute used to classify layer data.
- connection : string
- Layer connection or DSN.
- connectiontype : int
- See MS_CONNECTION_TYPE in map.h for possible values.
- data : string
- Layer data definition, values depend upon connectiontype.
- debug : int
- Enable debugging of layer. MS_ON or MS_OFF (default).
- dump : int
- Switch to allow mapserver to return data in GML format. MS_TRUE or
MS_FALSE. Default is MS_FALSE.
- filteritem : string
- Attribute defining filter.
- footer : string
- TODO
- group : string
- Name of a group of layers.
- header : string
- TODO
- index : int immutable
- Index of layer within parent map's layers array.
- labelcache : int
- MS_ON or MS_OFF. Default is MS_ON.
- labelangleitem : string
- Attribute defining label angle.
- labelitem : string
- Attribute defining feature label text.
- labelrequires : string
- Logical expression.
- labelsizeitem : string
- Attribute defining label size.
- labelmaxscale : float
- Maximum scale at which layer will be labeled.
- labelminscale : float
- Minimum scale at which layer will be labeled.
- map : mapObj immutable
- Reference to parent map.
- maxfeatures : int
- Maximum number of layer features that will be drawn. For shapefile data
this means the first N features where N = maxfeatures.
- maxscale : float
- Maximum scale at which layer will be drawn.
- minscale : float
- Minimum scale at which layer will be drawn.
- name : string
- Unique identifier for layer.
- numclasses : int immutable
- Number of layer classes.
- numitems : int immutable
- Number of layer feature attributes (items).
- numjoins : int immutable
- Number of layer joins.
- numprocessing : int immutable
- Number of raster processing directives.
- offsite : colorObj
- transparent pixel value for raster layers.
- postlabelcache : int
- MS_TRUE or MS_FALSE. Default is MS_FALSE. TODO not entirely clear
whether this overrides the labelcache attribute.
- requires : string
- Logical expression.
- sizeunits : int
- Units of class size values. See MS_UNITS in map.h.
- status : int
- MS_ON, MS_OFF, or MS_DEFAULT.
- styleitem : string
- Attribute defining styles.
- symbolscale : float
- Scale at which symbols are default size.
- template : string
- Template file. Note that for historical reasons, the query attribute
must be non-NULL for a layer to be queryable.
- tileindex : string
- Layer index file for tiling support.
- tileitem : string
- Attribute defining tile paths.
- tolerance : float
- Search buffer for point and line queries.
- toleranceunits : int
- See MS_UNITS in map.h.
- transform : int
- Whether or not layer data is to be transformed to image units.
MS_TRUE or MS_FALSE. Default is MS_TRUE. Case of MS_FALSE is for
data that are in image coordinates such as annotation points.
- transparency : int
- Layer transparency in range [0, 100].
- type : int
- See MS_LAYER_TYPE in map.h.
- units : int
- Units of the layer. See MS_UNITS in map.h.
TODO
- new layerObj( mapObj parent_map ) : layerObj
- Create a new layerObj in parent_map. The layer index of the new layerObj
will be equal to the parent_map numlayers - 1.
- addFeature( shapeObj shape ) : int
- Add a new inline feature on a layer. Returns -1 on error.
TODO: Is this similar to inline features in a mapfile? Does it work
for any kind of layer or connection type?
- applySLD( string sld, string stylelayer ) : int
- Apply the SLD document to the layer object.
The matching between the sld document and the layer will be done
using the layer's name.
If a namedlayer argument is passed (argument is optional),
the NamedLayer in the sld that matchs it will be used to style
the layer. See SLD HOWTO for more information on the SLD support.
- applySLDURL( string sld, string stylelayer ) : int
- Apply the SLD document pointed by the URL to the layer object. The
matching between the sld document and the layer will be done using
the layer's name.
If a namedlayer argument is passed (argument is optional),
the NamedLayer in the sld that matchs it will be used to style
the layer.
See SLD HOWTO for more information on the SLD support.
- clearProcessing( ) : int
- Clears the layer's raster processing directives. Returns the subsequent
number of directives, which will equal MS_SUCCESS if the directives have
been cleared.
- close( ) : void
- Close the underlying layer.
- demote( ) : void
- Moves this layer below the following layer on the same map.
- draw( mapObj map, imageObj image ) : int
- Renders this layer into the target image, adding labels to the cache if
required. Returns MS_SUCCESS or MS_FAILURE.
TODO: Does the map need to be the map on which the layer is defined?
I suspect so.
- drawQuery( mapObj map, imageObj image ) :
- Draw query map for a single layer into the target image. Returns
MS_SUCCESS or MS_FAILURE.
- executeWFSGetFeature( layer ) : string
- Executes a GetFeature request on a WFS layer and returns the
name of the temporary GML file created. Returns an empty
string on error.
- generateSLD( ) : void
- Returns an SLD XML string based on all the classes found in the layers.
- getClass( int i ) : classObj
- Fetch the requested class object. Returns NULL if the class index is
out of the legal range. The numclasses field contains the number of
classes available, and the first class is index 0.
- getExtent( ) : rectObj
- Fetches the extents of the data in the layer. This normally requires a
full read pass through the features of the layer and does not work for
raster layers.
- getFilter( ) : string
- Returns the current filter expression.
- getFirstMetaDataKey( ) : string
- Returns the first key in the metadata hash table. With
getNextMetaDataKey( ), provides an opaque iterator over keys.
- getItem( int i ) : string
- Returns the requested item. Items are attribute fields, and this method
returns the item name (field name). The numitems field contains the
number of items available, and the first item is index zero.
- getMetaData( string key ) : string
- Return the value at key from the metadata hash table.
- getNextMetaDataKey( string lastkey ) : string
- Returns the next key in the metadata hash table or NULL if
lastkey is the last valid key. If lastkey is NULL, returns the
first key of the metadata hash table.
- getNumFeatures( ) : int
- Returns the number of inline features in a layer. TODO: is this
really only online features or will it return the number of non-inline
features on a regular layer?
- getProcessing( int index) : string
- Return the raster processing directive at index.
- getNumResults( ) : int
- Returns the number of entries in the query result cache for this layer.
- getResult( int i ) : resultCacheMemberObj
- Fetches the requested query result cache entry, or NULL if the index is
outside the range of available results. This method would normally only
be used after issuing a query operation.
- getWMSFeatureInfoURL( mapObj map, int click_x, int click_y, int feature_count, string info_format ) : string
- 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.
- getShape( shapeObj shape, int tileindex, int shapeindex ) : int
- Get a shape from layer data.
- NEXT_GENERATION_API getShape( int shapeindex [, int tileindex=0 ] ) : shapeObj
- Get a shape from layer data using the next generation API.
- moveClassDown( int class ) : int
- The class specified by the class index will be moved up into
the array of layers. Returns MS_SUCCESS or MS_FAILURE.
ex. moveClassDown(1) will have the effect of moving class 1
down to postion 2, and the class at position 2 will be moved
to position 1.
- moveClassUp( int class ) : int
- The class specified by the class index will be moved up into
the array of layers. Returns MS_SUCCESS or MS_FAILURE.
ex. moveClassUp(1) will have the effect of moving class 1
up to postion 0, and the class at position 0 will be moved
to position 1.
- open( ) : void
- Opens the underlying layer. This is required before operations like
getShape( ) will work, but is not required before a draw or query call.
- promote( ) : void
- Moves this layer over the preceeding layer on the same map.
- queryByAttributes( mapObj map, string qitem, string qstring, int mode ) : int
Query layer for shapes that intersect current map extents. qitem is the
item (attribute) on which the query is performed, and qstring is the
expression to match. 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.
Note that the layer's FILTER/FILTERITEM are ignored by this function.
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.
- queryByFeatures( mapObj map, int slayer ) : int
- 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.
- queryByPoint( mapObj map, pointObj point, int mode, double buffer ) : int
- 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.
- queryByRect( mapObj map, rectObj rect ) : int
- 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.
- queryByShape( mapObj map, shapeObj shape ) : int
- 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
TODO: What shape is being used? Does slayer need to be a layer
with a single polygon?
- removeClass( int index ) : void
- Removes the class indicated. Note that subsequent classes will be
renumbered by this operation. The numclasses field contains the number
of classes available.
- removeMetaData( string key ) : int
- Delete the metadata hash at key. Returns MS_SUCCESS or
MS_FAILURE.
- setFilter( string filter ) : int
- Sets a filter expression similarly to the FILTER expression in a map
file. Returns MS_SUCCESS on success or MS_FAILURE if the expression
fails to parse.
- setMetaData( string key, string value ) : int
- Assign value to the metadata hash at key. Return MS_SUCCESS
or MS_FAILURE.
- setProcessing( string directive ) : void
- Adds a new processing directive line to a layer, similar to the PROCESSING
directive in a map file. Processing directives supports are specific to
the layer type and underlying renderer.
- setProjection( string proj4 ) : int
- Set the layer projection using a PROJ.4 format projection definition.
(ie. "+proj=utm +zone=11 +datum=WGS84"). Returns MS_SUCCESS or
MS_FAILURE.
- setWKTProjection( string wkt ) : int
- Set the layer projection using OpenGIS Well Known Text format. Returns
MS_SUCCESS or MS_FAILURE.
legendObj is associated with mapObj
+--------+ 0..1 1 +-----+
| Legend | <--------> | Map |
+--------+ +-----+
and with labelObj.
+--------+ 1 1 +-------+
| Legend | ---------> | Label |
+--------+ +-------+
- imagecolor : colorObj
- Legend background color.
- label : labelObj
- legend label.
- keysizex : int
- Width in pixels of legend keys.
- keysizey : int
- Pixels.
- keyspacingx : int
- Horizontal padding around keys in pixels.
- keyspacingy : int
- Vertical padding.
- map : mapObj
- Reference to parent mapObj.
- outlinecolor : colorObj
- key outline color.
- position : int
- MS_UL, MS_UC, MS_UR, MS_LL, MS_LC, or MS_LR.
- postlabelcache : int
- MS_TRUE or MS_FALSE.
- status : int
- MS_ON, MS_OFF, or MS_EMBED.
- template : string
- Path to template file.
A lineObj is composed of one or more pointObj instances.
+------+ 0..1 1..* +-------+
| Line | ---------> | Point |
+------+ +-------+
- numpoints : int immutable
- Number of points in the line.
- add( pointObj point ) : int
- Add point to the line. Returns MS_SUCCESS or MS_FAILURE.
- NEXT_GENERATION_API addPoint( pointObj point ) : int
- Add point to the line. Returns MS_SUCCESS or MS_FAILURE.
- get( int index ) : pointObj
- Return reference to point at index.
- NEXT_GENERATION_API getPoint( int index ) : pointObj
- Return reference to point at index.
- project( projectionObj proj_in, projectionObj proj_out ) : int
- Transform line in place from proj_in to proj_out. Returns
MS_SUCCESS or MS_FAILURE.
- set( int index, pointObj point ) : int
- Set the point at index to point. Returns MS_SUCCESS or MS_FAILURE.
- NEXT_GENERATION_API setPoint( int index, pointObj point ) : int
- Set the point at index to point. Returns MS_SUCCESS or MS_FAILURE.
A mapObj is primarily associated with instances of layerObj.
+-----+ 1 0..* +-------+
| Map | <--------> | Layer |
+-----+ +-------+
Secondary associations are with legendObj, scalebarObj, referenceMapObj,
and symbolSetObj.
+-----+ 1 0..1 +--------------+
| Map | ---------> | Legend |
+-----+ | ------------ |
| Scalebar |
| ------------ |
| ReferenceMap |
+ ------------ +
| SymbolSet |
+--------------+
and outputFormatObj.
+-----+ 1 1..* +--------------+
| Map | ---------> | OutputFormat |
+-----+ +------------- +
- cellsize : float
- Pixel size in map units.
- datapattern : string
- TODO not sure this is meaningful for mapscript.
- debug : int
- MS_TRUE or MS_FALSE.
- extent : rectObj
- Map's spatial extent.
- fontset : fontSetObj
- The map's defined fonts.
- height : int
- Height in pixels.
- imagecolor : colorObj
- Initial map background color.
- imagetype : string immutable
- Name of the current output format.
- lablecache : labelCacheObj
- Map's labelcache.
- legend : legendObj
- Reference to map's legend.
- mappath : string
- Filesystem path of the map's mapfile.
- maxsize : int
- TODO ?
- name : string
- Unique identifier.
- numlayers : int immutable
- Number of map layers.
- numoutputformats : int
- Number of output formats.
- outputformat : outputFormatObj
- The currently selected output format.
- palette : paletteObj
- TODO should this be deprecated?
- querymap : queryMapObj
- TODO should this be exposed to mapscript?
- reference : referenceMapObj
- Reference to reference map.
- resolution : float
- Nominal DPI resolution. Default is 72.
- scale : float
- The nominal map scale. A value of 25000 means 1:25000 scale.
- scalebar : scalebarObj
- Reference to the scale bar.
- shapepath : string
- Base filesystem path to layer data.
- status : int
- MS_OFF, MS_ON, or MS_DEFAULT.
- symbolset : symbolSetObj
- The map's set of symbols.
- templatepattern : string
- TODO not sure this is meaningful for mapscript.
- units : int
- MS_DD, MS_METERS, etc.
- web : webObj
- Reference to map's web definitions.
- width : int
- Width in pixels.
TODO
- appendOutputFormat( outputFormatObj format ) : int
- Attach format to the map's output format list. Returns the updated
number of output formats.
- applyConfigOptions( ) : void
- Apply the defined configuration options set by setConfigOption().
- applySLD( string sldxml ) : int
- Parse the SLD XML string sldxml and apply to map layers. Returns
MS_SUCCESS or MS_FAILURE.
- applySLDURL( string sldurl ) : int
- Fetch SLD XML from the URL sldurl and apply to map layers. Returns
MS_SUCCESS or MS_FAILURE.
- clone( ) : mapObj
Returns a clone of the map. Presently, the map's fontset and
symbolset are not copied and users must explicitly set these for the
cloned map. See http://mapserver.gis.umn.edu/bugs/show_bug.cgi?id=557.
map_clone = map_orig.clone( )
map_clone.setFontSet("absolute/path/to/fontset/file")
map_clone.setSymbolSet("absolute/path/to/symbolset/file")
img = map_clone.draw( )
- draw( ) : imageObj
- Draw the map, processing layers according to their defined order and
status. Return an imageObj.
- drawLabelCache( imageObj image ) : int
- Draw map's label cache on image. Returns MS_SUCCESS or MS_FAILURE.
- drawLegend( ) : imageObj
- Draw map legend, returning an imageObj.
- drawQuery( ) : imageObj
- Draw query map, returning an imageObj.
- drawReferenceMap( ) : imageObj
- Draw reference map, returning an imageObj.
- drawScalebar( ) : imageObj
- Draw scale bar, returning an imageObj.
- embedLegend( imageObj image ) : int
- Embed map's legend in image. Returns MS_SUCCESS or MS_FAILURE.
- embedScalebar( imageObj image ) : int
- Embed map's scalebar in image. Returns MS_SUCCESS or MS_FAILURE.
- generateSLD( ) : string
- Return SLD XML as a string for map layers.
- getConfigOption( string key ) : string
- Fetches the value of the requested configuration key if set. Returns
NULL if the key is not set.
- getFirstMetaDataKey( ) : string
- Returns the first key in the web.metadata hash table. With
getNextMetaDataKey( ), provides an opaque iterator over keys.
- getLayer( int index ) : layerObj
- Returns a reference to the layer at index.
- getLayerByName( string name ) : layerObj
- Returns a reference to the named layer.
- getLayersDrawingOrder( ) : int*
- Returns an array of layer indexes in drawing order.
Note
Unless the proper typemap is implemented for the module's language
a user is more likely to get back an unuseable SWIG pointer to the
integer array.
- getMetaData( string key ) : string
- Return the value at key from the web.metadata hash table.
- getNextMetaDataKey( string lastkey ) : string
- Returns the next key in the web.metadata hash table or NULL if
lastkey is the last valid key. If lastkey is NULL, returns the
first key of the metadata hash table.
- getOutputFormatByName( string imagetype ) : outputFormatObj
- Return the output format corresponding to driver name imagetype or
to format name imagetype. This works exactly the same as the
IMAGETYPE directive in a mapfile, is case insensitive and allows
an output format to be found either by driver (like 'GD/PNG') or
name (like 'PNG24').
- getProjection( ) : string
- Returns the PROJ.4 definition of the map's projection.
- getSymbolByName( string name ) : int
- Return the index of the named symbol in the map's symbolset.
Note
This method is poorly named and too indirect. It is preferrable to use
the getSymbolByName method of symbolSetObj, which really does return a
symbolObj reference, or use the index method of symbolSetObj to get a
symbol's index number.
- loadMapContext( string filename ) : int
- Load map defintion from an OGC XML file on disk. Returns MS_SUCCESS
or MS_FAILURE.
- moveLayerDown( int layerindex ) : int
- Move the layer at layerindex down in the drawing order array, meaning
that it is drawn later. Returns MS_SUCCESS or MS_FAILURE.
- moveLayerUp( int layerindex ) : int
- Move the layer at layerindex up in the drawing order array, meaning
that it is drawn earlier. Returns MS_SUCCESS or MS_FAILURE.
- nextLabel( ) : labelCacheMemberObj
- Return the next label from the map's labelcache, allowing iteration
over labels.
- prepareImage( ) : imageObj
- Returns an imageObj initialized to map extents and outputformat.
- prepareQuery( ) : void
- TODO this function only calculates the scale or am I missing
something?
- processLegendTemplate( string names[], string values[], int numitems ) : string
- Process MapServer legend template and return HTML.
- processTemplate( int generateimages, string names[], string values[], int numitems ) : string
- Process MapServer template and return HTML.
- processQueryTemplate( string names[], string values[], int numitems ) : string
- Process MapServer query template and return HTML.
Note
None of the three template processing methods will be useable unless
the proper typemaps are implemented in the module for the target
language. Currently the typemaps are not implemented.
- queryByFeatures( int layerindex ) : int
- Query map layers, result sets contain features that intersect or are
contained within the features in the result set of the MS_LAYER_POLYGON
type layer at layerindex. Returns MS_SUCCESS or MS_FAILURE.
- queryByPoint( pointObj point, int mode, float buffer ) : int
- Query map layers, result sets contain one or more features, depending
on mode, that intersect point within a tolerance buffer.
Returns MS_SUCCESS or MS_FAILURE.
- queryByRect( rectObj rect ) : int
- Query map layers, result sets contain features that intersect or are
contained within rect. Returns MS_SUCCESS or MS_FAILURE.
- queryByShape( shapeObj shape ) : int
- Query map layers, result sets contain features that intersect or are
contained within shape. Returns MS_SUCCESS or MS_FAILURE.
- removeLayer( int index ) : int
- Remove the layer at index.
- removeMetaData( string key ) : int
- Delete the web.metadata hash at key. Returns MS_SUCCESS or
MS_FAILURE.
- removeOutputFormat( string name ) : int
- Removes the format named name from the map's output format list.
Returns MS_SUCCESS or MS_FAILURE.
- save( string filename ) : int
- Save map to disk as a new map file. Returns MS_SUCCESS
or MS_FAILURE.
- saveMapContext( string filename ) : int
- Save map definition to disk as OGC-compliant XML. Returns MS_SUCCESS
or MS_FAILURE.
- saveQuery( string filename ) : int
- Save query to disk. Returns MS_SUCCESS or MS_FAILURE.
- saveQueryAsGML( string filename ) : int
- Save query to disk. Returns MS_SUCCESS or MS_FAILURE.
- setConfigOption( string key, string value ) : void
- Set the indicated key configuration option to the indicated value.
Equivalent to including a CONFIG keyword in a map file.
- setExtent( float minx, float miny, float miny, float maxy ) : int
- Set the map extent, returns MS_SUCCESS or MS_FAILURE.
- setFontSet( string filename ) : int
- Load fonts defined in filename into map fontset. The existing
fontset is cleared. Returns MS_SUCCESS or MS_FAILURE.
- setImageType( string name ) : void
- Sets map outputformat to the named format.
- setLayersDrawingOrder( int layerindexes[]) : int
- Set map layer drawing order.
Note
Unless the proper typemap is implemented for the module's language
users will not be able to pass arrays or lists to this method and
it will be unusable.
- setMetaData( string key, string value ) : int
- Assign value to the web.metadata hash at key. Return MS_SUCCESS
or MS_FAILURE.
- setOutputFormat( outputFormatObj format ) : void
- Sets map outputformat.
- setProjection( string proj4 ) : int
- Set map projection from PROJ.4 definition string proj4.
- setSymbolSet( string filename ) : int
- Load symbols defined in filename into map symbolset. The existing
symbolset is cleared. Returns MS_SUCCESS or MS_FAILURE.
- setWKTProjection( string wkt ) : int
- Sets map projection from OGC definition wkt.
- zoomPoint( int zoomfactor, pointObj imgpoint, int width, int height, rectObj extent, rectObj maxextent ) : int
- Zoom by zoomfactor to imgpoint in pixel units within the image of
height and width dimensions and georeferenced extent. Zooming
can be constrained to a maximum maxextent. Returns MS_SUCCESS or
MS_FAILURE.
- zoomRectangle( rectObj imgrect, int width, int height, rectObj extent, rectObj maxextent ) : int
- Zoom to a pixel coordinate rectangle in the image of width and height
dimensions and georeferencing extent. Zooming can be constrained to a
maximum maxextent. Returns MS_SUCCESS or MS_FAILURE.
- zoomScale( float scale, pointObj imgpoint, int width, int height, rectObj extent, rectObj maxextent) : int
- Like the previous methods, but zooms to the point at a specified scale.
A pointObj instance may be associated with a lineObj.
+-------+ 1..* 0..1 +------+
| Point | <--------- | Line |
+-------+ +------+
- m : float
- Measure. Meaningful only for measured shapefiles.
- x : float
- Easting
- y : float
- Northing
- new pointObj( [ float x=0.0, float y=0.0, float m=2e-38 ] ) : pointObj
- Create new instance. Easting, northing, and measure arguments are
optional.
- distanceToPoint( pointObj point ) : float
- Returns the distance to point.
- distanceToSegment( pointObj point1, pointObj point2 ) : float
- Returns the minimum distance to a hypothetical line segment connecting
point1 and point2.
- distanceToShape( shapeObj shape ) : float
- Returns the minimum distance to shape.
- draw( mapObj map, layerObj layer, imageObj image, int classindex, string text ) : int
- Draw the point using the styles defined by the classindex class of
layer and labeled with string text. Returns MS_SUCCESS or MS_FAILURE.
- project( projectionObj proj_in, projectionObj proj_out ) : int
- Reproject point from proj_in to proj_out. Transformation
is done in place. Returns MS_SUCCESS or MS_FAILURE.
- setXY( float x, float y [, float m=2e-38 ] ) : int
- Set spatial coordinate and, optionally, measure values simultaneously.
The measure will be set only if the value of m is greater than the
ESRI measure no-data value of 1e-38. Returns MS_SUCCESS or MS_FAILURE.
This class is not really fully implemented yet. MapServer's Maps and Layers
have Projection attributes, and these are C projectionObj structures, but are
not directly exposed by the mapscript module. Currently we have to do
some round-a-bout logic like this
point.project(projectionObj(mapobj.getProjection( ),
projectionObj(layer.getProjection( ))
to project a point from map to layer reference system.
- numargs : int immutable
- Number of PROJ.4 arguments.
- new projectionObj( string proj4 ) : projectionObj
- Create new instance of projectionObj. Input parameter proj4 is a
PROJ.4 definition string such as "init=EPSG:4269".
Has no other existence than as an attribute of a mapObj.
- color : colorObj
- Foreground color.
- height : int
- Height in pixels.
- width : int
- Width in pixels.
- status : int
- MS_OFF or MS_ON.
- style : int
- See map.h for possible styles.
A rectObj may be a lone object or an attribute of another object and has no
other associations.
- maxx : float
- Maximum easting
- maxy : float
- Maximum northing
- minx : float
- Minimum easting
- miny : float
- Minimum northing
- new rectObj( [ float minx=0.0, float miny=0.0, float maxx=0.0, float maxy=0.0 ] ) : rectObj
- Create new instance. The four easting and northing arguments
are optional.
- draw( mapObj map, layerObj layer, imageObj img, int classindex, string text ) : int
- Draw rectangle into img using style defined by the classindex class
of layer. The rectangle is labeled with the string text. Returns
MS_SUCCESS or MS_FAILURE.
- project( projectionObj proj_in, projectionObj proj_out ) : int
- Reproject rectangle from proj_in to proj_out. Transformation
is done in place. Returns MS_SUCCESS or MS_FAILURE.
- toPolygon( ) : shapeObj
- Convert to a polygon of five vertices.
A referenceMapObj is associated with mapObj.
+--------------+ 0..1 1 +-----+
| ReferenceMap | <--------> | Map |
+--------------+ +-----+
- color : colorObj
- Color of reference box.
- extent : rectObj
- Spatial extent of reference in units of parent map.
- height : int
- Height of reference map in pixels.
- image : string
- Filename of reference map image.
- map : mapObj
- Reference to parent mapObj.
- marker : int
- Index of a symbol in the map symbol set to use for marker.
- markername : string
- Name of a symbol.
- markersize : int
- Size of marker.
- maxboxsize : int
- Pixels.
- minboxsize : int
- Pixels.
- outlinecolor : colorObj
- Outline color of reference box.
- status : int
- MS_ON or MS_OFF.
- width : int
- In pixels.
A single query result. Associated with resultCacheObj.
+-------------------+ 0..* 1 +-------------+
| ResultCacheMember | <--------- | ResultCache |
+-------------------+ +-------------+
By using several indexes, a resultCacheMemberObj refers to a single layer
feature.
- classindex : int immutable
- The index of the layer class into which the feature has been classified.
- shapeindex : int immutable
- Index of the feature within the layer.
- tileindex : int immutable
- Meaningful for tiled layers only, index of the shapefile data tile.
Set of results of most recent query. Is always an attribute of a mapObj.
Associated with resultCacheMemberObj.
+-------------+ 1 0..* +-------------------+
| ResultCache | ---------> | ResultCacheMember |
+-------------+ +-------------------+
- bounds : int immutable
- Bounds or spatial extent of query results.
- numresults : int immutable
- The number of query results.
None.
Note
In future versions we are likely to explore moving or copying the
layerObj.getResult method to the resultCacheObj class.
A scalebarObj is associated with mapObj.
+----------+ 0..1 1 +-----+
| Scalebar | <--------- | Map |
+----------+ +-----+
and also with labelObj
+----------+ 1 1 +-------+
| Scalebar | ---------> | Label |
+----------+ +-------+
- backgroundcolor : colorObj
- Scalebar background color.
- color : colorObj
- Scalebar foreground color.
- imagecolor : colorObj
- Background color of scalebar.
- height : int
- Pixels.
- intervals : int
- Number of intervals.
- label : labelObj
- Scalebar label.
- outlinecolor : colorObj
- Foreground outline color.
- position : int
- MS_UL, MS_UC, MS_UR, MS_LL, MS_LC, or MS_LR.
- postlabelcache : int
- MS_TRUE or MS_FALSE.
- status : int
- MS_ON, MS_OFF, or MS_EMBED.
- style : int
- 0 or 1.
- units : int
- See MS_UNITS in map.h.
- width : int
- Pixels.
Class for read-write access to shapefiles, but not to shapefile attributes.
Each feature of a layer's data is a shapeObj. Each part of the shape is a
closed lineObj.
+-------+ 1 1..* +------+
| Shape | --------> | Line |
+-------+ +------+
- bounds : rectObj
- Bounding box of shape.
- classindex : int
- The class index for features of a classified layer.
- index : int
- Feature index within the layer.
- numlines : int immutable
- Number of parts.
- numvalues : int immutable
- Number of shape attributes.
- text : string
- Shape annotation.
- tileindex : int
- Index of tiled file for tileindexed layers.
- type : int
- MS_SHAPE_POINT, MS_SHAPE_LINE, MS_SHAPE_POLYGON, or MS_SHAPE_NULL.
- new shapeObj( int type ) : shapeObj
- Return a new shapeObj of the specified type. See the type attribute
above.
- add( lineObj line ) : int
- Add line (i.e. a part) to the shape. Returns MS_SUCCESS or MS_FAILURE.
- NEXT_GENERATION_API addLine( lineObj line ) : int
- Add line (i.e. a part) to the shape. Returns MS_SUCCESS or MS_FAILURE.
- contains( pointObj point ) : int
- Returns MS_TRUE if the point is inside the shape, MS_FALSE otherwise.
- copy( shapeObj shape_copy ) : int
- Copy the shape to shape_copy. Returns MS_SUCCESS or MS_FAILURE.
- NEXT_GENERATION_API copy( ) : shapeObj
- Return a copy of the shape.
- distanceToPoint( pointObj point ) : float
- Return distance to point.
- distanceToShape( shapeObj shape ) : float
- Return the minimum distance to shape.
- draw( mapObj map, layerObj layer, imageObj img ) : int
- Draws the individual shape using layer. Returns MS_SUCCESS or MS_FAILURE.
- get( int index ) : lineObj
- Returns a reference to part at index. Reference is valid
only during the life of the shapeObj.
- NEXT_GENERATION_API getLine( int index ) : lineObj
- Returns a reference to part at index. Reference is valid
only during the life of the shapeObj.
- getValue( int i ) : string
- Return the shape attribute at index i.
- intersects( shapeObj shape ) : int
- Returns MS_TRUE if the two shapes intersect, MS_FALSE otherwise.
- project( projectionObj proj_in, projectionObj proj_out ) : int
- Reproject shape from proj_in to proj_out. Transformation
is done in place. Returns MS_SUCCESS or MS_FAILURE.
- setBounds : void
Must be called to calculate new bounding box after new parts have been
added.
TODO: should return int and set msSetError.
An instance of styleObj is associated with one instance of classObj .
+-------+ 0..* 1 +-------+
| Style | <-------- | Class |
+-------+ +-------+
Support for multiple class styles is a new feature in the current unstable
(4.1) Mapscript and in the next stable (4.2) release. The initial feature
request and notes are archived at
http://mapserver.gis.umn.edu/bugs/show_bug.cgi?id=548.
An instance of styleObj can exist outside of a classObj container and
be explicitly inserted into the classObj for use in mapping.
new_style = new styleObj( )
the_class.insertStyle(new_style)
It is important to understand that insertStyle() inserts a copy of the
styleObj instance, not a reference to the instance itself.
The more standard use case
new_style = new styleObj(the_class)
remains supported. These will be the only ways to access the styles of
a class. Programmers should no longer directly access the styles attribute.
- backgroundcolor : colorObj
- Background pen color.
- color : colorObj
- Foreground or fill pen color.
- minsize : int
- Minimum pen or symbol width for scaling styles.
- maxsize : int
- Maximum pen or symbol width for scaling.
- offsetx : int
- Draw with pen or symbol offset from map data.
- offsety : int
- Draw with pen or symbol offset from map data.
- outlinecolor : colorObj
- Outline pen color.
- size : int
- Pixel width of the style's pen or symbol.
- symbol : int
- The index within the map symbolset of the style's symbol.
- symbolname : string immutable
- Name of the style's symbol.
- new styleObj( [ classObj parent_class ] ) : styleObj
- Returns new default style Obj instance. The parent_class is
optional.
A symbolObj is associated with one symbolSetObj.
+--------+ 0..* 1 +-----------+
| Symbol | <-------- | SymbolSet |
+--------+ +-----------+
A styleObj will often refer to a symbolObj by name or index, but this is
not really an object association, is it?
- antialias : int
- MS_TRUE or MS_FALSE.
- character : string
- For TrueType symbols.
- filled : int
- MS_TRUE or MS_FALSE.
- font : string
- For TrueType symbols.
- gap : int
- TODO what is this?
- imagepath : string
- Path to pixmap file.
- linecap : int
- TODO unsure about the cartoline attributes.
- linejoin : int
- TODO
- linejoinmaxsize : float
- TODO
- name : string
- Symbol name
- numpoints : int immutable
- Number of points of a vector symbol.
- position : int
- TODO ?
- sizex : float
- TODO what is this?
- sizey : float
- TODO what is this?
- stylelength : int
- Number of intervals
- transparent : int
- TODO what is this?
- transparentcolor : int
- TODO is this a derelict attribute?
- type : int
- MS_SYMBOL_SIMPLE, MS_SYMBOL_VECTOR, MS_SYMBOL_ELLIPSE, MS_SYMBOL_PIXMAP,
MS_SYMBOL_TRUETYPE, or MS_SYMBOL_CARTOLINE.
TODO
- new symbolObj( string symbolname [, string imagefile ] ) : symbolObj
- Create new default symbol named name. If imagefile is specified,
then the symbol will be of type MS_SYMBOL_PIXMAP.
- getPoints( ) : lineObj
- Returns the symbol points as a lineObj.
- setPoints( lineObj line ) : int
- Sets the symbol points from the points of line. Returns the updated
number of points.
- setStyle( int index, int value ) : int
- Set the style at index to value. Returns MS_SUCCESS or MS_FAILURE.
A symbolSetObj is an attribute of a mapObj and is associated with instances
of symbolObj.
+-----------+ 1 0..* +--------+
| SymbolSet | --------> | Symbol |
+-----------+ +--------+
- numsymbols : int immutable
- Number of symbols in the set.
- new symbolSetObj( [ string symbolfile ] ) : symbolSetObj
- Create new instance. If symbolfile is specified, symbols will be
loaded from the file.
- appendSymbol( symbolObj symbol ) : int
- Add a copy of symbol to the symbolset and return its index.
- getSymbol( int index ) : symbolObj
- Returns a reference to the symbol at index.
- getSymbolByName( string name ) : symbolObj
- Returns a reference to the symbol named name.
- index( string name ) : int
- Return the index of the symbol named name or -1 in the case that
no such symbol is found.
- removeSymbol( int index ) : symbolObj
- Remove the symbol at index and return a copy of the symbol.
- save( string filename ) : int
- Save symbol set to a file. Returns MS_SUCCESS or MS_FAILURE.
Has no other existence than as an attribute of a mapObj. Serves as a
container for various run-time web application definitions like temporary
file paths, template paths, etc.
- empty : string
- TODO
- error : string
- TODO
- extent : rectObj
- Clipping extent.
- footer : string
- Path to footer document.
- header : string
- Path to header document.
- imagepath : string
- Filesystem path to temporary image location.
- imageurl : string
- URL to temporary image location.
- log : string
- TODO
- map : mapObj
- Reference to parent mapObj.
- maxscale : float
- Maximum map scale.
- maxtemplate : string
- TODO
- minscale : float
- Minimum map scale.
- mintemplate : string
- TODO
- queryformat : string
- TODO
- template : string
- Path to template document.