# ol-ext
*Cool extensions for [OpenLayers](https://github.com/openlayers/openlayers) (ol)*.

[ol-ext](https://github.com/Viglino/ol-ext) is a set of extensions, controls, interactions, popup to use with Openlayers.    
[View live examples online](http://viglino.github.io/ol-ext/) or the [API documentation](http://viglino.github.io/ol-ext/doc/doc-pages/).

**Keywords:** 
Storymap,
Timeline control,
CSS popup, 
Font Awesome symbols, 
charts for statistical map (pie/bar), 
layer switcher,
control bar,
wikipedia layer, 
legend control,
search,
animations,
undo/redo mechanisms

> [
![Font style](img/map.style.font.jpg?raw=true)
![Charts](img/map.style.chart.jpg?raw=true)
![](img/map.style.pattern.jpg?raw=true)
![](img/map.style.photo.jpg?raw=true)
![](img/map.style.textpath.jpg?raw=true)
![](img/map.filter.colorize.jpg?raw=true)
![](img/map.control.compass.jpg?raw=true)
![](img/map.control.graticule.jpg?raw=true)
![](img/map.interaction.transform.jpg?raw=true)
![](img/map.control.editbar.jpg?raw=true)
![](img/map.switcher.image.jpg?raw=true)
![](img/map.control.profil.jpg?raw=true)
![](img/map.control.swipe.jpg?raw=true)
![](img/map.popup.anim.jpg?raw=true)
![](img/map.layer.hexbin.jpg?raw=true)
![](img/map.geom.cspline.jpg?raw=true)
![](img/map.cluster.convexhull.jpg?raw=true)
![](img/map.overlay.magnify.jpg?raw=true)
![](img/map.filter.lego.jpg?raw=true)
![](img/map.interaction.synchronize.jpg?raw=true)
](http://viglino.github.io/ol-ext/)

## Getting Started

### NPM packages

ol-ext exist as ES6 modules ([ol-ext](https://www.npmjs.com/package/openlayers-ext)) and as pure js ([openlayers-ext](https://www.npmjs.com/package/openlayers-ext)).

### using ol-ext in a webpack

* For use with webpack, Rollup, Browserify, or other module bundlers, install the npm [ol-ext package](https://www.npmjs.com/package/ol-ext) and link to the node_modules directory:
````
npm install ol-ext
````

See the following examples for more detail on bundling OpenLayers with your application:

* Using [webpack](https://github.com/darkscript/ol-ol-ext-webpack-example)
* Using [parcel](https://github.com/Viglino/ol-ext-parcel-bundler)
* Using [parcel](https://github.com/Viglino/ol-ext-angular)

### using ol-ext in a web page

* For use in a web page install the npm [openlayers-ext package](https://www.npmjs.com/package/openlayers-ext):
````
npm install openlayers-ext
````
The library will be available in the `node_modules/openlayers-ext/dist` directory. You can find individual files in the `node_modules/openlayers-ext/lib` directory.
* You can download the [scripts](dist) of the ./dist directory of the repository in your project and insert the .js and .css in your page.
* If you just want to add a `<script>` tag to test things out, you can link directly to the builds from the github rawgit (not recommended in production).
* For compatibility with older browsers and platforms (like Internet Explorer down to version 9 and Android 4.x), the Openalerys needs to be transpiled (e.g. using Babel) and bundled with polyfills for `requestAnimationFrame`, `Element.prototype.classList`, `Object.assign`and `URL`.

````html
<!-- Openlayers -->
<link rel="stylesheet" href="https://openlayers.org/en/latest/css/ol.css" />
<script type="text/javascript" src="https://openlayers.org/en/latest/build/ol.js"></script>
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=requestAnimationFrame,Element.prototype.classList,URL,Object.assign"></script>

<!-- ol-ext -->
<link rel="stylesheet" href="https://cdn.rawgit.com/Viglino/ol-ext/master/dist/ol-ext.min.css" />
<script type="text/javascript" src="https://cdn.rawgit.com/Viglino/ol-ext/master/dist/ol-ext.min.js"></script>
````

### dependencies

Using ol-ext prior to v3.1 some controls still depend on jQuery.

### suppoted Browsers

ol-ext runs on all modern browsers that support HTML5 and ECMAScript 5. This includes Chrome, Firefox, Safari and Edge. For older browsers and platforms like Internet Explorer (down to version 9) and Android 4.x, polyfills for for `requestAnimationFrame`, `Element.prototype.classList`, `Object.assign`and `URL`.


## Documentation

Check out the [hosted examples](http://viglino.github.io/ol-ext/) or the [API documentation](http://viglino.github.io/ol-ext/doc/doc-pages/).

## Contributing

Please see our [contributing guidelines](https://github.com/Viglino/ol-ext/blob/master/CONTRIBUTING.md) if you're interested in getting involved.

## Bugs

Please use the [GitHub issue tracker](https://github.com/Viglino/ol-ext/issues) for all bugs and feature requests. Before creating a new issue, do a quick search to see if the problem has been reported already.

## License

ol-ext is licensed under the French Opensource **BSD** compatible CeCILL-B FREE SOFTWARE LICENSE.  
 (c) 2016-2019 - Jean-Marc Viglino

Some resources (mapping services and API) used in this sofware may have a specific license.  
You must check before use.

> [Full text license in English](http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt)  
> [Full text license in French](http://www.cecill.info/licences/Licence_CeCILL-B_V1-fr.txt)

For convenience you can use the BSD licence instead when publish content to webpack.
