ol-ishare 1.0.2

iShare OpenLayers client

Astun Technology iShare Maps JavaScript client for OpenLayers v5 and above.

ES6 Modules

Modules are available at the root of the package and can be imported like so:

import { getLayerByName } from 'ol-ishare/olutil';
var lyr = getLayerByName(map.getLayerGroup(), 'primaryschools');

There are modules for requesting/ loading profiles etc. and apps such as Lite and Solo which use the low-level modules.

Use Webpack, Rollup, Parcel etc. or https://codesandbox.io/ to build your own app.

UMD Bundle

Pre-built bundle for use in browser. The UMD bundle exposes the API via an oli global variable.

For example the getLayerByName function in the ol-ishare/olutil module is exposed as:

var lyr = oli.olutil.getLayerByName(map.getLayerGroup(), 'primaryschools');

Bring your own dependencies

The UMD build does not include the ol and proj4 dependencies which must be loaded separately as browser globals.

LiteMap

The UMD Bundle includes the LiteMap class (available as ol.litemap.LiteMap) which can be used to create a map with layers from an iShare profile. The LiteMap functionality can be extended without a build step (for example adding a layer switcher or gazetteer search control as demonstrated in the examples/lite-umd.html example).

Polyfills

As with OpenLayers a small number of polyfills are required that provide functionality that is missing in older browsers such as Internet Explorer or Android 4.x. You can either bundle polyfills with your application if using the ES6 modules or include the polyfills in your page via a service such as the one hosted by CloudFlare for example:

<script src="https://cdnjs.cloudflare.com/polyfill/v3/polyfill.min.js?features=fetch,requestAnimationFrame,Array.prototype.find,Element.prototype.classList,URL"></script>