1.0.0 • Published 4 years ago
wms-capabilities-tools v1.0.0
wms-capabilities-tools
It parses the capabilities document of Web Map Services (WMS). The capabilities documents differentiate in the versions. This parser create a generic json of the capabilities document of all versions.
Installation
npm install wms-capabilities-tools
Get started
Example
Convert to JSON
Javascript
var fs = require("fs");
var cap = require('wms-capabilities-tools');
var xml = fs.readFileSync(__dirname + '/node_modules/wms-capabilities-tools/examples/capabilities/mapserver_130.xml');
var obj = cap.convertToJSON(xml);
console.log(JSON.stringify(obj, null, ' '));
Terminal:
{
"Version": "1.3.0",
"Title": "Stadtbezirke Bielefeld",
"Abstract": "Stadtbezirke in Bielefeld",
"GetMap": {
"URL": "http://www.bielefeld01.de/geodaten/geo_dienste/wms.php?url=gebietsgliederung_wms_stadtbezirke_641&language=ger&",
"Formats": [
"image/png",
"image/gif",
"image/jpeg"
],
"MaxWidth": "2500",
"MaxHeight": "2500",
"CRS": [
"EPSG:25832",
"EPSG:31467",
"EPSG:31466",
"EPSG:4326",
"EPSG:4258",
"EPSG:3038",
"EPSG:3039",
"EPSG:3040",
"EPSG:3041",
"EPSG:3042",
"EPSG:3043",
"EPSG:3044",
"EPSG:3045",
"EPSG:3046",
"EPSG:3047",
"EPSG:3857",
"EPSG:900913"
]
},
"Layer": [
{
"Name": "stadtbezirke_wms",
"Title": "Stadtbezirke Bielefeld",
"Abstract": "Stadtbezirke in Bielefeld",
"Layer": [
{
"Name": "stadtbezirke_pl",
"Title": "Stadtbezirk-Umringe",
"Abstract": "Stadtbezirke-Umringe in Bielefeld",
"Layer": []
},
{
"Name": "stadtbezirke_t",
"Title": "Stadtbezirke-Texte",
"Abstract": "Stadtbezirke-Texte in Bielefeld",
"Layer": []
}
]
}
]
}
Determine base URL of WMS
Javascript:
var cap = require('wms-capabilities-tools');
var urls = [];
urls.push('http://www.example.com/s?VERSION=1.3.0&p=9&VERSION=1.3.0');
urls.push('http://www.example.com/s&p1=9&&p2=1');
urls.push('tp://www.example.com/s?VERSION=1.3.0&p=9&VERSION=1.3.0');
urls.forEach(function(v) {
console.log(cap.determineBaseURL(v));
});
Terminal:
http://www.example.com/s?p=9&
http://www.example.com/s?p1=9&p2=1&
http://www.example.com/s?p=9&
Supported WMS
- 1.0.0
- 1.1.0
- 1.1.1
- 1.3.0
License
MIT