https://github.com/deniscarriere/ogc-parser
Parser to convert OGC WMTS/WMS XML schemas to human friendly JSON.
https://github.com/deniscarriere/ogc-parser
javascript nodejs ogc ogc-services wms wmts xpath
Last synced: 4 months ago
JSON representation
Parser to convert OGC WMTS/WMS XML schemas to human friendly JSON.
- Host: GitHub
- URL: https://github.com/deniscarriere/ogc-parser
- Owner: DenisCarriere
- License: mit
- Created: 2017-09-01T19:23:47.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2023-06-13T20:08:14.000Z (about 2 years ago)
- Last Synced: 2025-03-18T10:51:28.334Z (4 months ago)
- Topics: javascript, nodejs, ogc, ogc-services, wms, wmts, xpath
- Language: JavaScript
- Homepage: https://npm.runkit.com/ogc-parser
- Size: 441 KB
- Stars: 15
- Watchers: 2
- Forks: 3
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# OGC Parser
[](https://travis-ci.org/DenisCarriere/ogc-parser)
[](https://badge.fury.io/js/ogc-parser)
[](https://coveralls.io/github/DenisCarriere/ogc-parser?branch=master)
[](https://raw.githubusercontent.com/DenisCarriere/ogc-parser/master/LICENSE)
[](http://kangax.github.io/compat-table/es5/)[](https://github.com/feross/standard)
> Parser to convert OGC WMTS/WMS XML schemas to human friendly JSON.
## Install
**npm**
```bash
$ npm install --save ogc-parser
```**web browser ([ES5](https://kangax.github.io/compat-table/es5))**
```html
```
## Quickstart
```javascript
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**
```xml
1.0.0
OGC WMTS
...
```**capabilities**
```json
{
"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"
}
}
```