JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q48784F
  • License MIT

Wrap OpenLayers object creation with a simple function and config object

Package Exports

  • ol-wrapper

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ol-wrapper) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

ol-wrapper

A simple package that enables creating OpenLayers 3 objects using a nested config object, instead of multiple constructor calls.

Example: instead of

const map = new ol.Map({
    target: 'map-div',
    layers: [
        new ol.layer.Tile({
            source: new ol.source.XYZ({
                url: 'http://some.wmtsserver.com/{z}/{y}/{x}.png'
            })
        })
    ]
});

you can write

const map = olWrapper.createOlObject({
    olClass: 'Map', //can be emitted, 'Map' is the default
    layers: [
        {
            olClass: 'layer.Tile',
            source: {
                olClass: 'source.XYZ',
                url: 'http://some.wmtsserver.com/{z}/{y}/{x}.png'
            }
        }
    ]
});

Can be useful for saving map definitions in JSON objects.

Currently only with basic functionality, nothing is added over the OpenLayers 3 API.

Usage:

either add

<script src="https://unpkg.com/ol-wrapper/dist/ol-wrapper.min.js" type="text/javascript"></script>

or use browserify/webpack with

//es5
var createOlObject = require('ol-wrapper').createOlObject;

//es6
import {createOlObject} from 'ol-wrapper';