├── .gitignore ├── .project ├── .settings ├── .jsdtscope ├── org.eclipse.wst.jsdt.ui.superType.container └── org.eclipse.wst.jsdt.ui.superType.name ├── CHANGES.md ├── README.md ├── bower.json ├── demo-advanced.html ├── demo-geojson.json ├── demo-header.html ├── demo.html ├── leaflet-control.html ├── leaflet-core.html ├── leaflet-draw.html ├── leaflet-geojson.html ├── leaflet-geolocation.html ├── leaflet-import.html ├── leaflet-layer-group.html ├── leaflet-layer.html ├── leaflet-map.html ├── leaflet-marker.html ├── leaflet-popup.html ├── metadata.html └── preview.png /.gitignore: -------------------------------------------------------------------------------- 1 | /bower_components 2 | **/*~ 3 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | leaflet-map 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.wst.jsdt.core.javascriptValidator 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.wst.jsdt.core.jsNature 16 | 17 | 18 | -------------------------------------------------------------------------------- /.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.JRE_CONTAINER -------------------------------------------------------------------------------- /.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Global -------------------------------------------------------------------------------- /CHANGES.md: -------------------------------------------------------------------------------- 1 | v1.2.0 2 | ====== 3 | * propagate leaflet initialisation events (thanks to Fedor Baart) 4 | * fixed references to demos in README.md (thanks to Stephen Moore) 5 | * fire map-ready event when this.map is defined (thanks to David B. Calhoun) 6 | * add leaflet-point dom-module (thanks to Compufreak345) 7 | 8 | v1.1.0 9 | ====== 10 | * added support for styling GeoJson layers (thanks to Ryan Cooper) 11 | * renamed attributes on leaflet-map: no-dragging, no-touch-zoom, no-scroll-wheel-zoom, no-double-click-zoom, no-box-zoom, no-tap, no-track-resize, no-close-popup-on-click, no-bounce-at-zoom-limits, no-keyboard, no-inertia, no-zoom-control, no-attribution-control 12 | * renamed attributes on leaflet-marker: no-clickable, no-keyboard 13 | 14 | v1.0.2 15 | ====== 16 | * workaround for {s},{x},{y},{z} being escaped in tileset urls (thanks to Kevin Schaaf, John Eckhart, JustinCase1089) 17 | * fixed fitToMarkers (thanks to Horacio Gonzalez) 18 | * fixed an endless loop on dragging a highly zoomed map 19 | * various documentation fixes (thanks to David Calhoun) 20 | 21 | v1.0.1 22 | ====== 23 | * moved repository to https://github.com/leaflet-extras/leaflet-map 24 | * fixed some urls and version numbers 25 | 26 | v1.0.0 27 | ====== 28 | * breaking change: based on polymer 1.0, please check https://www.polymer-project.org/1.0/docs/migration.html 29 | * breaking change: camelCase attributes renamed to all lower case with hyphen (e.g. maxZoom renamed to max-zoom) 30 | * added geojson support (thanks to Rob Beers) 31 | * fixed marker.zIndexOffset (thanks to Jason Shortall) 32 | 33 | v0.3.2 34 | ====== 35 | * fixed syntax error in event handler for position updates of markers (thanks to bezineb5) 36 | 37 | v0.3.1 38 | ====== 39 | * fixed divIcon syntax error (thanks to spoobar) 40 | * fixed "observer_" not a variable in scope (thanks to fabiosantoscode) 41 | 42 | v0.3.0 43 | ====== 44 | * merged leaflet-map-component by Prateek Saxena (leaflet-circle, leaflet-polygon, leaflet-polyline) 45 | * added abstract leaflet-path element to style vector layers 46 | * added layer-group 47 | * split leaflet-map.html into leaflet-control.html, leaflet-layer.html, leaflet.map.html and leaflet-marker.html 48 | all files are included from leaflet-map.html, so no changes are required. 49 | 50 | v0.2.0 51 | ====== 52 | * changed dependency from leaflet_bower to leaflet (which is available on bower, too) 53 | * added support for leaflet-scale-control 54 | 55 | v0.1.1 56 | ====== 57 | * registered on bower 58 | 59 | v0.1.0 60 | ====== 61 | * dropped nhnb- prefix 62 | 63 | r0.0.2 64 | ====== 65 | * added support for leaflet-geolocation 66 | * added support for leaflet-tilelayer-wms 67 | * added demonstration of data binding in a custom component 68 | * changed property names to camelCase (attributes are case insensitive) 69 | 70 | r0.0.1 71 | ====== 72 | * added support for leaflet-divicon 73 | * fixed events from markers 74 | * added documentation for events 75 | 76 | r0.0.0 77 | ====== 78 | 79 | * first pre-release version 80 | * map, markers, icon, divicon, tilelayer 81 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # leaflet-map 2 | 3 | *leaflet-map* is a web-component which provides access to the [leaflet map](http://leafletjs.com) 4 | JavaScript library via html elements. 5 | 6 | Please have a look at the [demo](https://leaflet-extras.github.io/leaflet-map/demo.html) or the [api documentation](https://leaflet-extras.github.io/leaflet-map/doc.html#leaflet-map). 7 | 8 | Most of the options documented in the Leaflet reference are exported as html attributes. 9 | All events are mapped into html events of the same name.

10 | For example use <leaflet-map latitude="51.505" longitude="-0.09" zoom="13"> </leaflet-map> 11 | to define the view and zoom level. 12 | 13 | 14 | Web-components are an emerging standard which is based on Custom Elements, Shadow DOM, HTML Imports and Web Animations. 15 | [Polymer](http://www.polymer-project.org/docs/start/tutorial/intro.html) is a library which simplifies working with web-components. It includes a compatibility layer for browsers which 16 | do not yet support web-components natively, yet. 17 | 18 | 19 | ## Quickstart Guide 20 | 21 | Make leaflet maps using declarative [Polymer](http://polymer-project.org) web components. 22 | To get started read the [documentation](http://leaflet-extras.github.io/leaflet-map/doc.html) 23 | or checkout the [demo](http://leaflet-extras.github.io/leaflet-map/). 24 | 25 | Install this web component using [Bower](http://bower.io): 26 | 27 | ``` 28 | bower install leaflet-map 29 | ``` 30 | 31 | Import the main component and start creating your map: 32 | 33 | ```html 34 | 35 | 36 | 37 | 46 | 47 | 48 | 49 | 50 | Marker I 51 | 52 | 53 | Round 54 | 55 | 56 | 57 | ``` 58 | 59 | 60 | ## Status 61 | 62 | Although leaflet-map is still under heavy development, it is already fully usable. 63 | 64 | List of demos: 65 | 66 | * [leaflet-map](https://leaflet-extras.github.io/leaflet-map/demo.html#view) (L.map) 67 | * [leaflet-marker](https://leaflet-extras.github.io/leaflet-map/demo.html#marker) (L.marker) 68 | * [leaflet-icon](https://leaflet-extras.github.io/leaflet-map/demo.html#icon) (L.icon) 69 | * [leaflet-divicon](https://leaflet-extras.github.io/leaflet-map/demo.html#icon) (L.divicon) (since 0.0.1) 70 | * [leaflet-circle](https://leaflet-extras.github.io/leaflet-map/demo.html#vector) (L.circle) (since 0.3.0) 71 | * [leaflet-polygon](https://leaflet-extras.github.io/leaflet-map/demo.html#vector) (L.polygon) (since 0.3.0) 72 | * [leaflet-polyline](https://leaflet-extras.github.io/leaflet-map/demo.html#vector) (L.polyline) (since 0.3.0) 73 | * [leaflet-tilelayer](https://leaflet-extras.github.io/leaflet-map/demo.html#tilelayer) (L.tileLayer) 74 | * [leaflet-tilelayer-wms](https://leaflet-extras.github.io/leaflet-map/demo.html#layerwms) (L.tileLayer.wms) (since 0.0.2) 75 | * [leaflet-scale-control](https://leaflet-extras.github.io/leaflet-map/demo.html#scale) (L.control.scale) (since 0.2.0) 76 | * [leaflet-geojson](https://leaflet-extras.github.io/leaflet-map/demo.html#geojson) (since 0.4.0) 77 | * [leaflet-geolocation](https://leaflet-extras.github.io/leaflet-map/demo.html#databinding) (part of L.map) (since 0.0.2) 78 | 79 | Please have a look at the [change log](https://github.com/nhnb/leaflet-map/blob/master/CHANGES.md), for recent developments. 80 | 81 | ## Dependencies 82 | 83 | 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. 84 | 85 | Please note that the pages have to be accessed via a webserver. file://-urls are not supported. 86 | 87 | 88 | ## Notes for implementing child elements 89 | 90 | Child elements like markers or layers will be initialized by the surrounding container (the map or a layer) 91 | by setting a "container" javascript property. 92 | Therefore the child element should define a _containerChanged method and use that as initializer. 93 | Don't forget to define a detached method to support removal of elements. The leaflet-marker element is a good template. 94 | 95 | 96 | ## License 97 | 98 | leaflet-map is based on polymer and leaflet. Small parts of leaflet, 99 | especially the api documentation, have been copied into leaflet-map files. 100 | 101 | * [Leaflet](https://github.com/Leaflet/Leaflet/blob/master/LICENSE) 102 | * [Polymer](https://github.com/polymer/polymer/blob/master/LICENSE.txt) 103 | 104 | 105 | Copyright (c) 2014-2016 106 | Hendrik Brummermann, Prateek Saxena 107 | 108 | All rights reserved. 109 | 110 | Redistribution and use in source and binary forms, with or without modification, are 111 | permitted provided that the following conditions are met: 112 | 113 | 1. Redistributions of source code must retain the above copyright notice, this list of 114 | conditions and the following disclaimer. 115 | 116 | 2. Redistributions in binary form must reproduce the above copyright notice, this list 117 | of conditions and the following disclaimer in the documentation and/or other materials 118 | provided with the distribution. 119 | 120 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 121 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 122 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 123 | COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 124 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 125 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 126 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 127 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 128 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 129 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "leaflet-map", 3 | "version": "1.1.0", 4 | "authors": [ 5 | "Hendrik Brummermann ", 6 | "Prateek Saxena " 7 | ], 8 | "description": "Leaflet map as web-component based on polymer", 9 | "main": "leaflet-map.html", 10 | "homepage": "https://leaflet-extras.github.io/leaflet-map/", 11 | "keywords": [ 12 | "polymer", 13 | "web-components", 14 | "leaflet", 15 | "leafletjs", 16 | "map" 17 | ], 18 | "license": "BSD 2-Clause", 19 | "ignore": [ 20 | "**/.*", 21 | "demo.html", 22 | "node_modules", 23 | "bower_components", 24 | "test", 25 | "tests" 26 | ], 27 | "dependencies": { 28 | "polymer": "^1.0.0", 29 | "leaflet": "^0.7.3" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /demo-advanced.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 35 | 36 | 41 | -------------------------------------------------------------------------------- /demo-geojson.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "FeatureCollection", 3 | "features": [ 4 | { 5 | "type": "Feature", 6 | "geometry": { 7 | "type": "Point", 8 | "coordinates": [102.0, 0.5] 9 | }, 10 | "properties": { 11 | "prop0": "value0" 12 | } 13 | }, 14 | { 15 | "type": "Feature", 16 | "geometry": { 17 | "type": "LineString", 18 | "coordinates": [ 19 | [102.0, 0.0], 20 | [103.0, 1.0], 21 | [104.0, 0.0], 22 | [105.0, 1.0] 23 | ] 24 | }, 25 | "properties": { 26 | "prop0": "value0", 27 | "prop1": 0.0 28 | } 29 | }, 30 | { 31 | "type": "Feature", 32 | "geometry": { 33 | "type": "Polygon", 34 | "coordinates": [ 35 | [ 36 | [100.0, 0.0], 37 | [101.0, 0.0], 38 | [101.0, 1.0], 39 | [100.0, 1.0], 40 | [100.0, 0.0] 41 | ] 42 | ] 43 | }, 44 | "properties": { 45 | "prop0": "value0", 46 | "prop1": { 47 | "this": "that" 48 | } 49 | } 50 | } 51 | ] 52 | } -------------------------------------------------------------------------------- /demo-header.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 28 | 42 | 43 | -------------------------------------------------------------------------------- /demo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | leaflet-map web-component demo 7 | 8 | 9 | 10 | 11 | 12 | 13 | 93 | 94 | 95 | 96 | 97 | 98 | 99 |
100 | 101 | <leaflet-map> 1.0.0 was released on 2015-05-28. Please check out the change notes for breaking changes. 102 | 103 |
104 | 105 | 106 |
107 | 108 |

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.

109 | 110 | 111 |

Simple

112 | 113 |

Creating a leaflet based map is as simple as adding a <leaflet-map> tag after two lines of boilerplate code to load the web component platform and import the leaflet-map component.

114 | 115 | 116 | 117 |

118 | <script src="../webcomponentsjs/webcomponents-lite.min.js"></script>
119 | <link rel="import" href="leaflet-map.html">
120 | 
121 | <leaflet-map> </leaflet-map>
122 | 
123 | 
124 | 125 | 126 | 127 | 128 | 129 |

Initial View

130 | 131 |

Like normal html elements, the map is configurable with attributes. Those attributes correspond to the option parameter of L.map as defined in the leaflet documentation. For example the initial view is defined as follows:

132 | 133 | 134 | 135 | 136 |

137 | <leaflet-map latitude="51.505" longitude="-0.09" zoom="13">
138 | 
139 | </leaflet-map>
140 | 
141 | 
142 | 143 | 144 | 145 |

Marker

146 | 147 |

Markers can be defined using html tags as well. The following examples creates a semi transparent marker on the left hand side. And a second marker with a popup on click.

148 | 149 | 150 | 151 | 152 | 153 | 154 | Bold 155 |

Text

156 |
157 |
158 | 159 |

160 | <leaflet-map fit-to-markers>
161 | 
162 |     <leaflet-marker latitude="51.5" longitude="-0.10" title="Transparent"
163 |         opacity="0.6">  </leaflet-marker>
164 | 
165 |     <leaflet-marker latitude="51.5" longitude="-0.09" title="Popup Demo"> 
166 |         <b>Bold</b>
167 |         <p>Text</p>
168 |     </leaflet-marker>
169 | 
170 | </leaflet-map>
171 | 
172 | 
173 | 174 | 175 | 176 | 177 |

Marker with custom icons

178 | 179 |

Markers are based on formating templates called "icons". There are three ways to reference such an icon definition:

180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 206 | 207 |

The template icon may be defined using <leaflet-icon> elements. This is the prefered way. Please note that iconSize is mapped to the attributes iconWidth and iconHeight. iconAnchor is mapped to iconAnchorX and iconAnchorY and so on:

208 | 209 |

210 | <leaflet-icon id="myicon" 
211 |     icon-url="https://stendhalgame.org/images/mapmarker/me.png"> </leaflet-icon>
212 | 
213 | <leaflet-marker latitude="51.5" longitude="-0.10" title="Element" icon="myicon">
214 | </leaflet-marker>
215 | 	
216 | 
217 | 218 |

Alternatively plain json is understood, too:

219 | 220 |

221 | <leaflet-marker latitude="51.5" longitude="-0.09" title="Icon json" 
222 |     icon='{"iconUrl": "https://stendhalgame.org/images/mapmarker/dungeon.png"}'> 
223 | </leaflet-marker>
224 | 
225 | 
226 | 227 |

Last but not least, an instance of L.icon may be assigned:

228 | 229 |

230 | 
231 | <leaflet-marker id="icon-ref" latitude="51.5" longitude="-0.8" title="L.icon()">
232 | </leaflet-marker>
233 | 
234 | <script>
235 |     document.addEventListener("load", function() {
236 |         var marker = document.getElementById("icon-ref");
237 |         marker.icon = L.icon({
238 |             "iconUrl": "https://stendhalgame.org/images/mapmarker/npc.png",
239 |             "iconSize": L.point(26, 25),
240 |             "iconAnchor": L.point(0, 0)
241 |         });
242 |     });
243 | </script>
244 | 
245 | 
246 | 247 |

Circles, polyline and polygons

248 | 249 |

Circles, polylines and polygons can be drawn on the map.

250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | Hi, I am a polygon. 258 | 259 | 260 | 262 | Hi, I am a circle. 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 274 | 275 | 276 | 277 | 278 | 279 |

280 | <leaflet-map longitude="77.6" latitude="12.95" zoom="12">
281 | 
282 |   <leaflet-polygon color="#f00">
283 |     <leaflet-point longitude="77.5700" latitude="12.9700"> </leaflet-point>
284 |     <leaflet-point longitude="77.6034" latitude="13.0001"> </leaflet-point>
285 |     <leaflet-point longitude="77.6006" latitude="12.9547"> </leaflet-point>
286 | 
287 |      Hi, I am a <b>polygon</b>.
288 |   </leaflet-polygon>
289 | 
290 |   <leaflet-circle longitude="77.58" latitude="12.93"
291 |      radius="2000" color="#0a0" fillColor="#aa0" fillOpacity="0.5" fill="true"
292 |      
293 |      Hi, I am a <b>circle</b>.
294 |   </leaflet-circle>
295 | 
296 |   <leaflet-polyline>
297 |     <leaflet-point longitude="77.6400" latitude="12.9100"> </leaflet-point>
298 |     <leaflet-point longitude="77.6229" latitude="12.9259"> </leaflet-point>
299 |     <leaflet-point longitude="77.6499" latitude="12.9699"> </leaflet-point>
300 |     <leaflet-point longitude="77.6119" latitude="12.9738"> </leaflet-point>
301 |   </leaflet-polyline>
302 | 
303 |   <leaflet-circle longitude="77.64" latitude="12.93"
304 |      radius="500" color="#0a0" fillColor="#077">
305 |   </leaflet-circle>
306 | 
307 | </leaflet-map>
308 | 
309 | 
310 | 311 | 312 | 313 | 314 | 315 | 316 |

Tile layer

317 | 318 |

Custom tile layers, for example from online games can be defined using the leaflet-tilelayer element. If there is no explicit tilelayer defined, a default one will be used as shown in previous examples.

319 | 320 | 321 | 322 | 325 | 326 | Map source: Stendhal MMORPG 327 | 328 | 329 | 330 | 331 | 332 | 333 |

334 | <leaflet-map latitude="78.8" longitude="-96" zoom="5" max-zoom="6">
335 | 
336 |     <leaflet-tilelayer 
337 |         url="https://stendhalgame.org/map/3/{z}-{x}-{y}.png"
338 |         min-zoom="2" max-zoom="6" noWrap>
339 | 
340 |             Map source: <a href="https://stendhalgame.org">Stendhal MMORPG</a>
341 | 
342 |     </leaflet-tilelayer>
343 | 
344 | </leaflet-map>
345 | 
346 | 
347 | 348 | 349 | 350 | 351 |

Tile layer WMS

352 | 353 |

It is possible to display data from external WMS services as tile layers on the map.

354 | 355 | 356 | 357 | 358 | 360 | Map data © OpenStreetMap contributors, 361 | CC-BY-SA, 362 | Imagery © Mapbox 363 | 364 | 365 | 368 | 369 | Weather data © 2012 IEM Nexrad 370 | 371 | 372 | 373 | 374 | 375 | 376 |

377 | <leaflet-map latitude="40" longitude="-85" zoom="4">
378 | 
379 |     <leaflet-tilelayer 
380 |         url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png" max-zoom="19">
381 |           Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contr., 
382 |           <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, 
383 |           Imagery © <a href="http://mapbox.com">Mapbox</a>
384 |     </leaflet-tilelayer>
385 | 
386 |     <leaflet-tilelayer-wms 
387 |         url="https://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r.cgi"
388 |         layers="nexrad-n0r-900913" format="image/png" transparent opacity="0.5">
389 | 
390 |             Weather data © 2012 IEM Nexrad
391 | 
392 |     </leaflet-tilelayer-wms>
393 | 
394 | </leaflet-map>
395 | 
396 | 
397 | 398 | 399 | 400 | 401 | 402 |

Events

403 | 404 |

Leaflet events are converted into html events which originate from the component.

405 | 406 | 407 |
Center: 51.505, -0.091
408 | 409 | 410 | 418 | 419 | 420 |

421 | <div id="eventout">Center: 51.505, -0.091</div>
422 | <leaflet-map latitude="51.505" longitude="-0.091" zoom="8"> </leaflet-map>
423 | 
424 | <script>
425 |     var map = document.getElementById("eventmap");
426 |     map.addEventListener("moveend", function(e) {
427 |         var text = "Center: " + this.latitude.toFixed(3)
428 |                               + ", " + this.longitude.toFixed(3);
429 |         document.getElementById("eventout").textContent = text; 
430 |     });
431 | </script>
432 | 
433 | 
434 | 435 | 436 | 437 | 438 | 439 |

Scale control

440 | 441 |

A scale control can be added and configured using <leaflet-scale-control>. By default it displays both metric and imperial units.

442 | 443 | 444 | 445 | 446 | 447 | 448 |

449 | <leaflet-map latitude="51.505" longitude="-0.09" zoom="13">
450 | 
451 |     <leaflet-scale-control position="topright" metric imperial>
452 |     </leaflet-scale-control>
453 | 
454 | </leaflet-map>
455 | 
456 | 
457 | 458 | 459 | 460 |

GeoJSON

461 | 462 |

Example of a GeoJSON layer, which is filled by an ajax request.

463 | 464 | 465 | 467 | Map data © OpenStreetMap contributors, 468 | CC-BY-SA, 469 | Imagery © Mapbox 470 | 471 | 472 | 476 | 477 | 478 | 479 | 480 |

481 | <leaflet-map latitude="0.3516" longitude="102.304" zoom="6">
482 | 
483 |     <leaflet-tilelayer 
484 |         url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png" max-zoom="19">
485 |           Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contr., 
486 |           <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, 
487 |           Imagery © <a href="http://mapbox.com">Mapbox</a>
488 |     </leaflet-tilelayer>
489 | 
490 |     <template is="dom-bind">
491 |       <iron-ajax url="demo-geojson.json" last-response="{{data}}" auto>
492 |       </iron-ajax>
493 |       <leaflet-geojson color="#FF0000" data="[[data]]"></leaflet-geojson>
494 |     </template>
495 | 
496 | </leaflet-map>
497 | 
498 | 
499 | 500 | 501 |

Data binding and custom components

502 | 503 |

Data binding can be used to create markers based on dynamic information, e. g. from the rows of a spreadsheet. 504 | In this example a new component is created which listens for location tracking information and sets a marker accordingly. 505 | A circle is used to indicate the range of uncertainty.

506 | 507 | 508 | 509 |
510 | 511 | 572 | 573 | 580 | 581 |
582 | 583 | 584 | -------------------------------------------------------------------------------- /leaflet-control.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 20 | 21 | 22 | 25 | 27 | 117 | 118 | -------------------------------------------------------------------------------- /leaflet-core.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 43 | 44 | 48 | 49 | 50 | 51 | 55 | 56 | 780 | -------------------------------------------------------------------------------- /leaflet-draw.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 14 | 308 | 309 | 310 | 311 | 312 | 313 | 330 | 331 | 334 | 336 | 337 | 430 | 431 | 432 | 433 | 434 | 451 | 452 | 469 | 470 | 471 | 472 | 473 | 492 | 493 | 494 | 497 | 500 | 501 | 502 | 546 | 547 | 548 | 568 | 569 | 570 | 573 | 576 | 577 | 578 | 625 | -------------------------------------------------------------------------------- /leaflet-geojson.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | 23 | 24 | 29 | 30 | 191 | -------------------------------------------------------------------------------- /leaflet-geolocation.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 15 | 16 | 19 | 21 | 22 | 23 | 265 | 266 | -------------------------------------------------------------------------------- /leaflet-import.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /leaflet-layer-group.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 18 | 19 | 20 | 22 | 23 | 24 | 65 | -------------------------------------------------------------------------------- /leaflet-layer.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 281 | 282 | 283 | 284 | 302 | 303 | 304 | 307 | 309 | 310 | 311 | 369 | 370 | 371 | 372 | 373 | 392 | 393 | 396 | 398 | 399 | 527 | -------------------------------------------------------------------------------- /leaflet-map.html: -------------------------------------------------------------------------------- 1 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /leaflet-marker.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | 19 | 22 | 24 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 259 | 260 | 263 | 265 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 385 | 386 | 389 | 391 | 757 | 758 | -------------------------------------------------------------------------------- /leaflet-popup.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /metadata.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leaflet-extras/leaflet-map/2ca9d9c83bef85a1b857070399e26b23d1ad3b63/preview.png --------------------------------------------------------------------------------