Skip to content

DenisCarriere/ogc-parser

Repository files navigation

OGC Parser

Build Status npm version Coverage Status MIT licensed ES5

Standard - JavaScript Style Guide

Parser to convert OGC WMTS/WMS XML schemas to human friendly JSON.

Install

npm

$ npm install --save ogc-parser

web browser (ES5)

<script src="https://wzrd.in/standalone/ogc-parser@latest"></script>

Quickstart

const fs = require('fs')
const xml = fs.readFileSync('ogc-wmts.xml', 'utf8')
const capabilities = ogcParser.wmts(xml)
capabilities.service.type
//=OGC WMTS
capabilities.service.version
//=1.0.0
capabilities.url.getCapabilities
//=http://localhost:80/WMTS/1.0.0/WMTSCapabilities.xml

ogc-wmts.xml

<declaration version="1.0" encoding="utf-8"/>
<Capabilities xmlns="http://www.opengis.net/wmts/1.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:gml="http://www.opengis.net/gml" xsi:schemaLocation="http://www.opengis.net/wmts/1.0 http://schemas.opengis.net/wmts/1.0/wmtsGetCapabilities_response.xsd" version="1.0.0">
  <ServiceMetadataURL xlink:href="http://localhost:80/WMTS/1.0.0/WMTSCapabilities.xml"/>
  <ows:ServiceIdentification>
    <ows:ServiceTypeVersion>1.0.0</ows:ServiceTypeVersion>
    <ows:ServiceType>OGC WMTS</ows:ServiceType>
...

capabilities

{
	"service": {
		"type": "OGC WMTS",
		"version": "1.0.0",
		"title": "Mapbox"
	},
	"layer": {
		"title": "Satellite Streets",
		"abstract": "© OSM, © DigitalGlobe",
		"identifier": "ciy23jhla008n2soz34kg2p4u",
		"format": "image/jpeg",
		"bbox": [
			-180,
			-85.051129,
			179.976804,
			85.051129
		],
		"minzoom": 0,
		"maxzoom": 20,
		"tileMatrixSets": [
			"GoogleMapsCompatible"
		]
	},
	"url": {
		"resourceURL": "https://api.mapbox.com/styles/v1/addxy/ciy23jhla008n2soz34kg2p4u/tiles/{TileMatrix}/{TileCol}/{TileRow}?access_token=pk.eyJ1IjoiYWRkeHkiLCJhIjoiY2lsdmt5NjZwMDFsdXZka3NzaGVrZDZtdCJ9.ZUE-LebQgHaBduVwL68IoQ",
		"getCapabilities": "https://api.mapbox.com/styles/v1/addxy/ciy23jhla008n2soz34kg2p4u/wmts?access_token=pk.eyJ1IjoiYWRkeHkiLCJhIjoiY2lsdmt5NjZwMDFsdXZka3NzaGVrZDZtdCJ9.ZUE-LebQgHaBduVwL68IoQ",
		"getTile": "https://api.mapbox.com/styles/v1/addxy/ciy23jhla008n2soz34kg2p4u/wmts?access_token=pk.eyJ1IjoiYWRkeHkiLCJhIjoiY2lsdmt5NjZwMDFsdXZka3NzaGVrZDZtdCJ9.ZUE-LebQgHaBduVwL68IoQ",
		"host": "api.mapbox.com"
	}
}

Releases

No releases published

Packages

No packages published