Most of the options documented in the Leaflet reference are exported as html attributes. All events are mapped into html events of the same name.For example use <leaflet-map latitude=“51.505” longitude=“-0.09” zoom=“13”> </leaflet-map> to define the view and zoom level.
Web-components are an emerging standard which is based on Custom Elements, Shadow DOM, HTML Imports and Web Animations. Polymer is a library which simplifies working with web-components. It includes a compatibility layer for browsers which do not yet support web-components natively, yet.
Install this web component using Bower:
bower install leaflet-map
Import the main component and start creating your map:
Although leaflet-map is still under heavy development, it is already fully usable.
List of demos:
- leaflet-map (L.map)
- leaflet-marker (L.marker)
- leaflet-icon (L.icon)
- leaflet-divicon (L.divicon) (since 0.0.1)
- leaflet-circle (L.circle) (since 0.3.0)
- leaflet-polygon (L.polygon) (since 0.3.0)
- leaflet-polyline (L.polyline) (since 0.3.0)
- leaflet-tilelayer (L.tileLayer)
- leaflet-tilelayer-wms (L.tileLayer.wms) (since 0.0.2)
- leaflet-scale-control (L.control.scale) (since 0.2.0)
- leaflet-geojson (since 0.4.0)
- leaflet-geolocation (part of L.map) (since 0.0.2)
Please have a look at the change log, for recent developments.
leaflet-map depends on webcomponentsjs in ../webcomponentsjs, Polymer in ../polymer and leaflet in ../leaflet. If you use bower, those will be installed automatically at the right locations.
Please note that the pages have to be accessed via a webserver. file://-urls are not supported.
Notes for implementing child elements
leaflet-map is based on polymer and leaflet. Small parts of leaflet, especially the api documentation, have been copied into leaflet-map files.
Copyright © 2014-2016 Hendrik Brummermann, Prateek Saxena
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.