-
Notifications
You must be signed in to change notification settings - Fork 9
Mapserver module api
pagameba edited this page Nov 19, 2010
·
10 revisions
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
Returns a Map object for the map file at the specified path.
Arguments are:
- 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
TODO: path is currently required, make optional
Returns a Map object.
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);
}
Returns the next error in the mapserver error stack or undefined
if there are no more errors.
Example: see loadMap()
example.