wms-capabilities
v0.6.0
Published
WMS service Capabilities > JSON, based on openlayers
Downloads
50,012
Readme
WMS GetCapabilities
parser
Parses WMS capabilities XML format to JSON. This is a simplified excerpt from OpenLayers code to be used separately from its large codebase.
Demo
Usage
ES
npm install wms-capabilities --save
import WMSCapabilities from 'wms-capabilities';
...
new WMSCapabilities().parse(xmlString);
//or
new WMSCapabilities(xmlString).toJSON();
// or
new WMSCapabilities().readFromDocument(xmldoc);
Browser
<script src="path/to/wms-capabilities.min.js"></script>
...
new WMSCapabilities().parse(xmlString);
Node
Requires xmldom
to traverse XML
$npm install --save xmldom
then
import xmldom from 'xmldom'; // 'xmldom' doesn't 'export' the DOMParser
import WMSCapabilities from 'wms-capabilities';
...
new WMSCapabilities(xmlString, xmldom.DOMParser).toJSON();
Command-line
$ npm install -g wms-capabilities
$ cat capabilities.xml | wmscapabilities > out.json
$ # or
$ wmscapabilities capabilities.json > out.json