A javascript library for interacting with OGC-compliant services
ogc-client is a pure Javascript library which implements several OGC standards and will help you interact with them in a user-friendly and consistent way.
Documentation and live demo here!
The following standards are partially implemented:
- WMS - Web Map Service
- WFS - Web Feature Service
Why no WMTS support? Because openlayers has a incredibly thorough and well-tested WMTS capabilities parser and you should just use it. Reimplementing it in ogc-client currently does not bring any significant value.
- ogc-client will abstract the service version so you don't have to worry about it
- ogc-client will handle XML so you only have to deal with native Javascript objects
- ogc-client will hide the complexity of OGC standards behind straightforward APIs
- ogc-client will run heavy tasks in a worker to avoid blocking the main thread
- ogc-client will keep a persistent cache of operations to minimize requests and processing
- ogc-client will handle errors in a graceful way and extract relevant messages for you
- ogc-client will tell you if a service is not usable for CORS-related issues
To install ogc-client, run:
$ npm install --save @camptocamp/ogc-client
To use, import API symbols like so:
import { WmsEndpoint, WfsEndpoint } from '@camptocamp/ogc-client';
Note: if you want to disable web worker usage, for example to solve issues with the Referer
header on outgoing
requests, use:
import { enableFallbackWithoutWorker } from '@camptocamp/ogc-client';
enableFallbackWithoutWorker()
All processing will be done on the main thread after this call, including HTTP requests.
TODO
A provided application containing the documentation and demo is located in the app
folder.
To start it locally, clone the repository and run the following commands:
$ cd app
$ npm install
$ npm run serve
The app is based on Vue.js 2 and will showcase most features implemented in the library. You will need to supply it with valid OGC service urls.