-
Notifications
You must be signed in to change notification settings - Fork 9
Mapserver module api
Most of the MS_XXXXX values are defined as constants through the mapserver module, for instance:
var mapserver = require('mapserver');
console.log('MS_ON value is ' + mapserver.MS_ON);
outputs
MS_ON value is 1
These methods are invoked directly on the module after it has been require
d.
returns the version information for mapserver as a string value
Example:
require('mapserver').getVersion();
returns
MapServer version 5.6.5 OUTPUT=GIF OUTPUT=PNG OUTPUT=WBMP OUTPUT=SVG SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=CAIRO SUPPORTS=FREETYPE SUPPORTS=ICONV SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER SUPPORTS=SOS_SERVER SUPPORTS=GEOS INPUT=EPPL7 INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE
Returns the version number for mapserver as an integer value.
Example:
require('mapserver').getVersionInt();
returns
50605
TODO: path is currently required, make optional
- mapfile - required string, path to the map file to open, relative to the process working directory
- path - optional string, path for mapserver with relative paths defined in the map file, assumed to be the process working directory if not set.
Returns a Map object for the map file at the specified path relative to the specified directory (for relative paths in the map file).
Throws an Error exception if the map could not be loaded. Use getError() to get specific details about the error that happened.
Example:
var mapserver = require('mapserver');
try {
var map = mapserver.loadMap('test.map');
} catch (e) {
var err = mapserver.getError();
console.log('Error ' + err.code + '('+ err.codeStr +') in ' + err.routine + ':' + err.message);
}
- mapfile - required string, contents of a map file
- path - optional string, path for mapserver with relative paths defined in the map file, assumed to be the process working directory if not set.
Returns a Map object initialized with the contents of the map as a string.
Throws an Error exception if the map could not be parsed. Use getError() to get specific details about the error that happened.
Example:
var mapserver = require('mapserver');
try {
var map = mapserver.loadMapFromString('MAP END');
} catch (e) {
var err = mapserver.getError();
console.log('Error ' + err.code + '('+ err.codeStr +') in ' + err.routine + ':' + err.message);
}
Clears the error stack
Example:
require('mapserver').resetErrorList();
Returns the next error in the mapserver error stack or undefined
if there are no more errors.
Example: see loadMap()
example.