wms-capabilities
TypeScript icon, indicating that this package has built-in type declarations

0.6.0 • Public • Published

WMS GetCapabilities parser

npm version

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

Package Sidebar

Install

npm i wms-capabilities

Weekly Downloads

8,708

Version

0.6.0

License

BSD-2-Clause

Unpacked Size

294 kB

Total Files

26

Last publish

Collaborators

  • w8r