mapscript.mapObj

class mapscript.mapObj(*args)

The MAP object

Overview

The mapObj has the following relationships:

../../../_images/mapObj_layerObj.png ../../../_images/mapObj_legendObj.png ../../../_images/mapObj_outputFormatObj.png ../../../_images/mapObj_referenceMapObj.png ../../../_images/mapObj_scalebarObj.png

Attributes

cellsize

double Pixel size in map units

configoptions

hashTableObj immutable A hash table of configuration options from CONFIG keywords in the map - see CONFIG

datapattern

char TODO - Deprecated use VALIDATION .

debug

int See DEBUG

defresolution

double Default resolution - used to calculate the scalefactor, see DEFRESOLUTION

extent

rectObj Map extent array - see EXTENT

fontset

fontSetObj immutable See FONTSET

height

int See SIZE

imagecolor

colorObj Holds the initial image color value - see IMAGECOLOR

imagequality

int TODO - Deprecated

imagetype

char immutable Name of current outputformat

interlace

int TODO - Deprecated

labelcache

labelCacheObj immutable We need this here so multiple feature processors can access it

layerorder

int Used to modify the order in which the layers are drawn - TODO should be immutable?

legend

legendObj immutable See LEGEND

mappath

char Path of the mapfile, all paths are relative to this path

maxlayers

int immutable Allocated size of layers[] array

maxsize

int See MAXSIZE

name

char Small identifier for naming etc - see NAME

numlayers

int immutable Number of layers in mapfile

numoutputformats

int immutable Number of output formats available in the map

outputformat

outputFormatObj immutable See OUTPUTFORMAT

querymap

queryMapObj immutable See QUERYMAP

refcount

int immutable Used for reference counting see RFC24

reference

referenceMapObj immutable See SCALEBAR

resolution

double See RESOLUTION

scalebar

scalebarObj immutable See SCALEBAR

scaledenom

double The nominal map scale, a value of 25000 means 1:25000 scale - see SCALEDENOM

shapepath

char Where are the shape files located - see SHAPEPATH

sldurl

char URL of SLD document as specified with "&SLD=..." WMS parameter d- currently this reference is used only in mapogcsld.c and has a NULL value outside that context

status

int Is map creation on or off - see STATUS

symbolset

symbolSetObj immutable See SYMBOLSET

templatepattern

char TODO - Deprecated use VALIDATION .

thisown

The membership flag

transparent

int TODO - Deprecated

units

enum MS_UNITS Units of the projection - see UNITS

web

webObj immutable See WEB

width

int See SIZE

Methods

OWSDispatch(req: OWSRequest) int[المصدر]

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 WMS, WFS, WCS and SOS requests supported by MapServer. Results of a dispatched request are written to stdout and can be captured using the msIO services (i.e. mapscript.msIO_installStdoutToBuffer() and mapscript.msIO_getStdoutBufferString()

__init__(*args)[المصدر]

Create a new instance of mapObj. Note that the filename is optional.

appendOutputFormat(format: outputFormatObj) 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()

applyDefaultSubstitutions() void[المصدر]

Apply any default values defined in a VALIDATION block used for runtime substitutions

applySLD(sld: char) int[المصدر]

Parse the SLD XML string sldxml and apply to map layers. Returns MS_SUCCESS or MS_FAILURE

applySLDURL(sld: char) int[المصدر]

Fetch SLD XML from the URL sldurl and apply to map layers. Returns MS_SUCCESS or MS_FAILURE

applySubstitutions(names: char) void[المصدر]

Pass in runtime substitution keys and values and apply them to the map. Note - this method is currently enabled for Python only. Typemaps are needed for other MapScript languages.

clone() mapObj[المصدر]

Returns a independent copy of the map, less any caches.

ملاحظة

In the Java module this method is named cloneMap.

convertToString() char[المصدر]

Saves the object to a string. Provides the inverse option for updateFromString.

draw() imageObj[المصدر]

Draw the map, processing layers according to their defined order and status. Return an imageObj.

drawLabelCache(image: imageObj) int[المصدر]

Draw map's label cache on image. Returns MS_SUCCESS or MS_FAILURE.

drawLegend(scale_independent: int = 0) 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(image: imageObj) int[المصدر]

Embed map's legend in image. Returns MS_SUCCESS or MS_FAILURE.

embedScalebar(image: imageObj) int[المصدر]

Embed map's legend in image. Returns MS_SUCCESS or MS_FAILURE.

freeQuery(qlayer: int = -1) void[المصدر]

Clear layer query result caches. Default is -1, or all layers.

generateSLD(sldVersion: char = None) char[المصدر]

Return SLD XML as a string for map layers that have STATUS on.

getConfigOption(key: char) char[المصدر]

Fetches the value of the requested configuration key if set. Returns NULL if the key is not set.

getLayer()[المصدر]
getLayerByName()[المصدر]
getLayerOrder() PyObject[المصدر]

Python MapScript only - returns the map layer order as a native sequence

getLayersDrawingOrder() intarray[المصدر]

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 unusable SWIG pointer to the integer array.

getNumSymbols() int[المصدر]

Return the number of symbols in map

getOutputFormat(i: int) outputFormatObj[المصدر]

Returns the output format at the specified i index from the output formats array or null if i is beyond the array bounds. The number of outpuFormats can be retrieved by calling mapObj.getNumoutputformats().

getOutputFormatByName(name: char) 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 'AGG/PNG') or name (like 'png').

getProjection() char[المصدر]

Returns the PROJ definition of the map's projection.

getRotation() double[المصدر]

Returns the map rotation angle.

getSize() PyObject[المصدر]

Python MapScript only - gets the map size as a tuple

getSymbolByName(name: char) int[المصدر]

Return the index of the named symbol in the map's symbolset.

ملاحظة

This method is poorly named and too indirect. It is preferable 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.

get_height()[المصدر]

Python MapScript only Return the map height from the map size

get_width()[المصدر]

Python MapScript only Return the map width from the map size

insertLayer()[المصدر]
loadMapContext(szFileName: char, useUniqueNames: int = 0) int[المصدر]

Load an OGC map context file to define extents and layers of a map Returns MS_SUCCESS or MS_FAILURE

loadOWSParameters(*args) int[المصدر]

Load OWS request parameters (BBOX, LAYERS, &c.) into map. Returns MS_SUCCESS or MS_FAILURE

loadQuery(filename: char) int[المصدر]

Load a saved query. Returns MS_SUCCESS or MS_FAILURE

moveLayerDown(layerindex: int) 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(layerindex: int) int[المصدر]

Move the layer at layerindex up in the drawing order array, meaning that it is drawn earlier. Returns MS_SUCCESS or MS_FAILURE

offsetExtent(x: double, y: double) int[المصدر]

Offset the map extent based on the given distances in map coordinates. Returns MS_SUCCESS or MS_FAILURE.

pixelToGeoref(pixPosX: double, pixPosY: double, geoPos: pointObj) void[المصدر]

TODO

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(names: char, values: char, numentries: int) char[المصدر]

Process MapServer legend template and return HTML. Note none of the three template processing methods will be usable unless the proper typemaps are implemented in the module for the target language.Currently the typemaps are not implemented.

processQueryTemplate(names: char, values: char, numentries: int) char[المصدر]

Process MapServer query template and return HTML. Note none of the three template processing methods will be usable unless the proper typemaps are implemented in the module for the target language.Currently the typemaps are not implemented.

processTemplate(bGenerateImages: int, names: char, values: char, numentries: int) char[المصدر]

Process MapServer template and return HTML. Note none of the three template processing methods will be usable unless the proper typemaps are implemented in the module for the target language.Currently the typemaps are not implemented.

queryByFeatures(slayer: int) 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 layer index slayer. Returns MS_SUCCESS or MS_FAILURE.

queryByFilter(string: char) int[المصدر]

Query map layers using the filter string. Returns MS_SUCCESS or MS_FAILURE.

queryByPoint(point: pointObj, mode: int, buffer: double) 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(rect: rectObj) 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 layer index slayer. Returns MS_SUCCESS or MS_FAILURE.

queryByShape(shape: shapeObj) 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

removeLayer(index: int) layerObj[المصدر]

Remove the layer at index. Returns the layerObj.

removeOutputFormat(name: char) int[المصدر]

Removes the format named name from the map's output format list. Returns MS_SUCCESS or MS_FAILURE

save(filename: char) int[المصدر]

Save map to disk as a new map file. Returns MS_SUCCESS or MS_FAILURE

saveMapContext(szFileName: char) int[المصدر]

Save map definition to disk as OGC-compliant XML. Returns MS_SUCCESS or MS_FAILURE

saveQuery(filename: char, results: int = 0) int[المصدر]

Save query to disk. Returns MS_SUCCESS or MS_FAILURE

saveQueryAsGML(*args) int[المصدر]

Save query to disk. Returns MS_SUCCESS or MS_FAILURE

scaleExtent(zoomfactor: double, minscaledenom: double, maxscaledenom: double) int[المصدر]

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

selectOutputFormat(imagetype: char) void[المصدر]

Set the map's active output format to the internal format named imagetype. Built-in formats are "PNG", "PNG24", "JPEG", "GIF", "GTIFF".

setCenter(center: pointObj) int[المصدر]

Set the map center to the given map point. Returns MS_SUCCESS or MS_FAILURE.

setConfigOption(key: char, value: char) void[المصدر]

Set the indicated key configuration option to the indicated value. Equivalent to including a CONFIG keyword in a map file.

setExtent(minx: double, miny: double, maxx: double, maxy: double) int[المصدر]

Set the map extent, returns MS_SUCCESS or MS_FAILURE. This method will correct the extents (width/height ratio) before setting the minx, miny, maxx, maxy values. See extent properties to set up a custom extent from rectObj.

setFontSet(filename: char) int[المصدر]
. Load fonts defined in filename into map fontset. The existing fontset is cleared.

Returns MS_SUCCESS or MS_FAILURE

setImageType(imagetype: char) void[المصدر]

Sets map outputformat to the named format.

ملاحظة

mapObj.setImageType() remains in the module but its use is deprecated in favor of mapObj.selectOutputFormat().

setLayerOrder(order: PyObject) int[المصدر]

Python MapScript only - sets the map layer order using a native sequence

setLayersDrawingOrder(panIndexes: int) 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.

setOutputFormat(format: outputFormatObj) void[المصدر]

Sets map outputformat.

setProjection(proj4: char) int[المصدر]

Set map projection from PROJ definition string proj4.

setRotation(rotation_angle: double) int[المصدر]

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

setSize(width: int, height: int) int[المصدر]
setSymbolSet(szFileName: char) int[المصدر]

Load symbols defined in filename into map symbolset. The existing symbolset is cleared. Returns MS_SUCCESS or MS_FAILURE

setWKTProjection(wkt: char) int[المصدر]

Sets map projection from OGC definition wkt.

set_height(value)[المصدر]

Python MapScript only Set the map height value of the map size

set_width(value)[المصدر]

Python MapScript only Set the map width value of the map size

zoomPoint(zoomfactor: int, poPixPos: pointObj, width: int, height: int, poGeorefExt: rectObj, poMaxGeorefExt: rectObj) int[المصدر]

Zoom by the given factor to a pixel position within the width and height bounds. If max_extent is not NULL, the zoom is constrained to the max_extents

Returns MS_SUCCESS or MS_FAILURE

zoomRectangle(poPixRect: rectObj, width: int, height: int, poGeorefExt: rectObj, poMaxGeorefExt: rectObj) int[المصدر]

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

zoomScale(scale: double, poPixPos: pointObj, width: int, height: int, poGeorefExt: rectObj, poMaxGeorefExt: rectObj) int[المصدر]

Zoom by the given factor to a pixel position within the width and height bounds. If max_extent is not NULL, the zoom is constrained to the max_extents