0.7.2 • Published 9 years ago

ol-wrapper v0.7.2

Weekly downloads
4
License
MIT
Repository
github
Last release
9 years ago

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';
0.7.2

9 years ago

0.7.1

9 years ago

0.7.0

9 years ago

0.6.1

9 years ago

0.6.0

9 years ago

0.5.7

10 years ago

0.5.6

10 years ago

0.5.5

10 years ago

0.5.4

10 years ago

0.5.3

10 years ago

0.5.2

10 years ago

0.5.1

10 years ago

0.5.0

10 years ago

0.5.0-beta

10 years ago