53 Commits

Author SHA1 Message Date
David Molineus
e0c853d0a9 Merge pull request #9 from qzminski/master
Update to Contao 5
2022-11-29 13:43:04 +01:00
Kamil Kuzminski
25f64dc818 Update to Contao v5 (composer only for now) 2022-09-01 16:34:10 +02:00
David Molineus
de22e28c1f Update leaflet providers to 1.13.0 2022-02-22 08:48:52 +01:00
David Molineus
ecc66d2935 Recompile assets 2020-12-18 11:01:28 +01:00
David Molineus
ad66ff7c00 Update Leaflet.ExtraMarkers to version 1.2.1 2020-12-18 10:56:42 +01:00
David Molineus
bddadbe22a Update Leaflet.Control.FullScreen to version 1.6.0 2020-12-18 10:44:16 +01:00
David Molineus
1baae82984 Update Leaflet.markercluster to version 1.4.1 2020-12-18 10:42:13 +01:00
David Molineus
a784851f20 Update leaflet to 1.7.1 2020-12-18 10:39:19 +01:00
David Molineus
996a3fb745 Update leaflet-control-geocoder to version 1.13.0 2020-12-18 10:36:51 +01:00
David Molineus
8045cdc07a Merge pull request #6 from sebj54/patch-1
Use leaflet.js instead of leaflet-src.js
2020-12-18 10:28:49 +01:00
Sébastien JEAN
4897509aee Use leaflet.js instead of leaflet-src.js
leaflet.js is more than twice lighter than leaflet-src.js
2019-03-27 18:47:18 +01:00
David Molineus
978ae8af21 Update to latest dependencies. 2018-08-23 16:02:27 +02:00
David Molineus
a8f73beb3d Update leaflet.pm to 0.25.0. 2018-08-23 15:48:59 +02:00
David Molineus
2f9602e21e Update LeafletExtraMarkers to 1.0.8. 2018-08-23 15:45:06 +02:00
David Molineus
9a21c60b9e Update Control.Geocoder to 1.6.0. 2018-08-23 15:42:45 +02:00
David Molineus
2f372e2d0e Update Control.FullScreen to 1.4.5. 2018-08-23 15:40:48 +02:00
David Molineus
3b187d0d95 Update leaflet.markercluster to v1.4.0. 2018-08-23 15:38:28 +02:00
David Molineus
44d1cf9550 Update leaflet providers to 1.3.1. 2018-08-23 15:35:24 +02:00
David Molineus
5b86360c35 Recompile leaflet.min.css. 2018-08-23 15:33:27 +02:00
David Molineus
22bde573d6 Switch to gulp v4. 2018-08-23 15:33:13 +02:00
David Molineus
74c10b652b Update leaflet to 1.3.4. 2018-08-23 14:57:27 +02:00
David Molineus
a89b9abc96 Hotfix geocoder merging c13ccf55da. Also minimize libraries. 2018-02-06 17:09:15 +01:00
David Molineus
bf88bbca8c Update leaflet geocoder. 2018-02-06 16:59:33 +01:00
David Molineus
232d223eee Fix branch aliases and apply spdx license format changes. 2018-01-27 13:38:31 +01:00
David Molineus
79fdad5ca3 Include leaflet.pm as new library. 2018-01-26 19:55:36 +01:00
David Molineus
c5b72d2c15 Update leaflet-markercluster to v1.3.0. 2018-01-26 19:44:04 +01:00
David Molineus
69b500a5fc Update leaflet to v1.3.1. 2018-01-26 15:01:39 +01:00
David Molineus
cbce9420ec Update Leaflet.markercluster to 1.1.0. 2017-10-17 09:59:20 +02:00
David Molineus
193c920e1b Update minified style. 2017-10-17 09:56:35 +02:00
David Molineus
ed594cfdd1 Update control geocoder to v1.5.5. 2017-10-17 09:56:11 +02:00
David Molineus
a2cdfddcc6 Use leaflet 1.2.0. 2017-10-17 09:51:56 +02:00
David Molineus
1f5add1d27 Update gitignore and gitattributes. 2017-10-09 15:13:24 +02:00
David Molineus
ad4b61f696 Update leaflet providers to 1.1.17 2017-07-06 16:51:37 +02:00
David Molineus
170c7e8d8e Update to marker cluster version 1.0.6. 2017-07-06 16:42:34 +02:00
David Molineus
eee8019f9d Update leaflet fullscreen. 2017-07-06 16:38:23 +02:00
David Molineus
442ecc7166 Update leaflet 1.1.0. 2017-07-06 16:31:05 +02:00
David Molineus
8c4b151b1d Use double pipes. 2017-01-27 12:15:15 +01:00
David Molineus
21fd7c8bd3 Update leaflet loading to version 0.1.24 2017-01-27 12:06:34 +01:00
David Molineus
df8851fc8b Update leaflet markercluster to version 1.0.2. 2017-01-27 12:03:48 +01:00
David Molineus
5ca0430872 Update to leaflet 1.0.3. 2017-01-27 11:59:16 +01:00
David Molineus
e985eb6cba Add notes about Contao 4 and the version number format. 2017-01-27 11:56:20 +01:00
David Molineus
6203fdc45d Support Contao 4.3. 2017-01-18 11:07:59 +01:00
David Molineus
383bff4d6d Merge tag '1.0.2' 2016-11-25 09:53:50 +01:00
David Molineus
396651d6be Synch dependencies between config.php and readme.md. 2016-11-25 09:53:36 +01:00
David Molineus
37efd85ad1 Update leaflet-control-geocoder to v1.5.4. 2016-11-25 09:44:27 +01:00
David Molineus
0dbb9424e2 Update leaflet-omnivore to 0.3.4. 2016-11-25 09:36:15 +01:00
David Molineus
aab101e58e Update to leaflet v1.0.2. 2016-11-25 09:26:08 +01:00
David Molineus
337a1c7458 Merge tag '1.0.0-beta2' 2016-11-14 13:48:53 +01:00
David Molineus
86faf4dd48 Implement the extra markers icons. 2016-11-14 13:31:19 +01:00
David Molineus
9f2d5d94dc Implementing extra markers. 2016-11-14 12:00:05 +01:00
David Molineus
5364c0f15e Refactor overpass support using own implementation of overpass layer. 2016-11-14 11:00:10 +01:00
David Molineus
4212248b27 Create minified css file. 2016-11-09 10:00:59 +01:00
David Molineus
90a08c29ef Add layer overpass. 2016-11-09 10:00:02 +01:00
94 changed files with 35742 additions and 16563 deletions

10
.gitattributes vendored Normal file
View File

@@ -0,0 +1,10 @@
.check-author.yml export-ignore
.gitattributes export-ignore
.github export-ignore
.gitignore export-ignore
.travis.yml export-ignore
build.default.properties export-ignore
build.xml export-ignore
phpunit.xml.dist export-ignore
/tests export-ignore
/specs export-ignore

30
.gitignore vendored
View File

@@ -1,8 +1,28 @@
/vendor/
/bin/
/.tx/
/node_modules/
# OS
.DS_Store
Thumbs.db
.directory
coverage.xml
# IDEs
.buildpath
.project
.settings/
.build/
.external*/
.idea/
nbproject/
# composer related
vendor/
composer.lock
# Node
/node_modules
package-lock.json
# build
build/
build.properties
# Translations
.tx

View File

@@ -12,13 +12,16 @@ Contao CMS.
This package contains following packages:
- [leaflet 1.0.1](http://leafletjs.com)
- [Leaflet-providers 1.1.15](http://leaflet-extras.github.io/leaflet-providers)
- [Leaflet.markercluster 1.0.0](https://github.com/Leaflet/Leaflet.markercluster)
- [Leaflet-omnivore 0.3.2](https://github.com/mapbox/leaflet-omnivore)
- [Leaflet.loading 0.1.23](https://github.com/ebrelsford/Leaflet.loading)
- [Leaflet.Control.FullScreen 1.4.2](https://github.com/brunob/leaflet.fullscreen)
- [Leaflet Control Geocoder 1.5.1](https://github.com/perliedman/leaflet-control-geocoder)
- [leaflet 1.7.1](http://leafletjs.com)
- [Leaflet-providers 1.13.0](http://leaflet-extras.github.io/leaflet-providers)
- [Leaflet.markercluster 1.4.1](https://github.com/Leaflet/Leaflet.markercluster)
- [Leaflet-omnivore 0.3.4](https://github.com/mapbox/leaflet-omnivore)
- [Leaflet.loading 0.1.24](https://github.com/ebrelsford/Leaflet.loading)
- [Leaflet.Control.FullScreen 1.6.0](https://github.com/brunob/leaflet.fullscreen)
- [Leaflet Control Geocoder 1.13.0](https://github.com/perliedman/leaflet-control-geocoder)
- [Leaflet.ExtraMarkers 1.2.1](https://github.com/coryasilva/Leaflet.ExtraMarkers)
- [leaflet.pm 0.25.0](https://github.com/codeofsumit/leaflet.pm)
- [osmtogeojson 2.2.12](https://github.com/tyrasd/osmtogeojson)
- [spin.js 2.3.2](http://fgnass.github.io/spin.js)
@@ -31,12 +34,23 @@ You can install this package via composer.
$ php composer.phar require netzmacht/contao-leaflet-libraries:~1.0
```
When releasing the first stable version of
[netzmacht/contao-leaflet-maps](https://github.com/netzmacht/contao-leaflet-maps) the version number gonna be the same
as the included leaflet library.
If you use Contao 4 without the managed edition, you also have to register the module as a bundle.
```php
<?php
// Dependency is automatically installed and has to be registered
new Contao\CoreBundle\HttpKernel\Bundle\ContaoModuleBundle('leaflet-libs', $this->getRootDir()),
```
Version numbers
---------------
Each release has is tagged with the main leaflet version which is shipped with this bundle. For any bugfix release which
is created without shipping a newer version of leaflet, this package uses four parts of the version number.
License
-------
As this package is just a meta package to provide the libraries, the licenses of each library have to be accepted. They
are unter the MIT or BSD license.
are under the MIT or BSD license.

View File

@@ -1,122 +1,126 @@
.leaflet-control-geocoder {
border-radius: 4px;
background: white;
min-width: 26px;
min-height: 26px;
border-radius: 4px;
background: white;
min-width: 26px;
min-height: 26px;
}
.leaflet-touch .leaflet-control-geocoder {
min-width: 30px;
min-height: 30px;
min-width: 30px;
min-height: 30px;
}
.leaflet-control-geocoder a, .leaflet-control-geocoder .leaflet-control-geocoder-icon {
border-bottom: none;
display: inline-block;
.leaflet-control-geocoder a,
.leaflet-control-geocoder .leaflet-control-geocoder-icon {
border-bottom: none;
display: inline-block;
}
.leaflet-control-geocoder .leaflet-control-geocoder-alternatives a {
width: inherit;
height: inherit;
line-height: inherit;
width: inherit;
height: inherit;
line-height: inherit;
}
.leaflet-control-geocoder a:hover, .leaflet-control-geocoder .leaflet-control-geocoder-icon:hover {
border-bottom: none;
display: inline-block;
.leaflet-control-geocoder a:hover,
.leaflet-control-geocoder .leaflet-control-geocoder-icon:hover {
border-bottom: none;
display: inline-block;
}
.leaflet-control-geocoder-form {
display: none;
vertical-align: middle;
display: none;
vertical-align: middle;
}
.leaflet-control-geocoder-expanded .leaflet-control-geocoder-form {
display: inline-block;
display: inline-block;
}
.leaflet-control-geocoder-form input {
font-size: 120%;
border: 0;
background-color: transparent;
width: 246px;
font-size: 120%;
border: 0;
background-color: transparent;
width: 246px;
}
.leaflet-control-geocoder-icon {
border-radius: 4px;
width: 26px;
height: 26px;
border: none;
background-color: white;
background-image: url(images/geocoder.png);
background-repeat: no-repeat;
background-position: center;
border-radius: 4px;
width: 26px;
height: 26px;
border: none;
background-color: white;
background-image: url(images/geocoder.png);
background-repeat: no-repeat;
background-position: center;
cursor: pointer;
}
.leaflet-touch .leaflet-control-geocoder-icon {
width: 30px;
height: 30px;
width: 30px;
height: 30px;
}
.leaflet-control-geocoder-throbber .leaflet-control-geocoder-icon {
background-image: url(images/throbber.gif);
background-image: url(images/throbber.gif);
}
.leaflet-control-geocoder-form-no-error {
display: none;
display: none;
}
.leaflet-control-geocoder-form input:focus {
outline: none;
outline: none;
}
.leaflet-control-geocoder-form button {
display: none;
display: none;
}
.leaflet-control-geocoder-error {
margin-top: 8px;
margin-left: 8px;
display: block;
color: #444;
margin-top: 8px;
margin-left: 8px;
display: block;
color: #444;
}
.leaflet-control-geocoder-alternatives {
display: block;
width: 272px;
list-style: none;
padding: 0;
margin: 0;
display: block;
width: 272px;
list-style: none;
padding: 0;
margin: 0;
}
.leaflet-control-geocoder-alternatives-minimized {
display: none;
height: 0;
display: none;
height: 0;
}
.leaflet-control-geocoder-alternatives li {
white-space: nowrap;
display: block;
overflow: hidden;
padding: 5px 8px;
text-overflow: ellipsis;
border-bottom: 1px solid #ccc;
cursor: pointer;
white-space: nowrap;
display: block;
overflow: hidden;
padding: 5px 8px;
text-overflow: ellipsis;
border-bottom: 1px solid #ccc;
cursor: pointer;
}
.leaflet-control-geocoder-alternatives li a, .leaflet-control-geocoder-alternatives li a:hover {
width: inherit;
height: inherit;
line-height: inherit;
background: inherit;
border-radius: inherit;
text-align: left;
.leaflet-control-geocoder-alternatives li a,
.leaflet-control-geocoder-alternatives li a:hover {
width: inherit;
height: inherit;
line-height: inherit;
background: inherit;
border-radius: inherit;
text-align: left;
}
.leaflet-control-geocoder-alternatives li:last-child {
border-bottom: none;
border-bottom: none;
}
.leaflet-control-geocoder-alternatives li:hover, .leaflet-control-geocoder-selected {
background-color: #f5f5f5;
.leaflet-control-geocoder-alternatives li:hover,
.leaflet-control-geocoder-selected {
background-color: #f5f5f5;
}
.leaflet-control-geocoder-address-detail {
}
.leaflet-control-geocoder-address-context {
color: #666;
}
color: #666;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
.leaflet-control-geocoder .leaflet-control-geocoder-icon,.leaflet-control-geocoder .leaflet-control-geocoder-icon:hover,.leaflet-control-geocoder a,.leaflet-control-geocoder a:hover{border-bottom:none;display:inline-block}.leaflet-control-geocoder{border-radius:4px;background:#fff;min-width:26px;min-height:26px}.leaflet-touch .leaflet-control-geocoder{min-width:30px;min-height:30px}.leaflet-control-geocoder .leaflet-control-geocoder-alternatives a{width:inherit;height:inherit;line-height:inherit}.leaflet-control-geocoder-form{display:none;vertical-align:middle}.leaflet-control-geocoder-expanded .leaflet-control-geocoder-form{display:inline-block}.leaflet-control-geocoder-form button,.leaflet-control-geocoder-form-no-error{display:none}.leaflet-control-geocoder-form input{font-size:120%;border:0;background-color:transparent;width:246px}.leaflet-control-geocoder-icon{border-radius:4px;width:26px;height:26px;border:none;background-color:#fff;background-image:url('images/geocoder.png');background-repeat:no-repeat;background-position:center}.leaflet-touch .leaflet-control-geocoder-icon{width:30px;height:30px}.leaflet-control-geocoder-throbber .leaflet-control-geocoder-icon{background-image:url('images/throbber.gif')}.leaflet-control-geocoder-form input:focus{outline:0}.leaflet-control-geocoder-error{margin-top:8px;margin-left:8px;display:block;color:#444}.leaflet-control-geocoder-alternatives{display:block;width:272px;list-style:none;padding:0;margin:0}.leaflet-control-geocoder-alternatives-minimized{display:none;height:0}.leaflet-control-geocoder-alternatives li{white-space:nowrap;display:block;overflow:hidden;padding:5px 8px;text-overflow:ellipsis;border-bottom:1px solid #ccc;cursor:pointer}.leaflet-control-geocoder-alternatives li a,.leaflet-control-geocoder-alternatives li a:hover{width:inherit;height:inherit;line-height:inherit;background:inherit;border-radius:inherit;text-align:left}.leaflet-control-geocoder-alternatives li:last-child{border-bottom:none}.leaflet-control-geocoder-alternatives li:hover,.leaflet-control-geocoder-selected{background-color:#f5f5f5}.leaflet-control-geocoder-address-context{color:#666}
.leaflet-control-geocoder{border-radius:4px;background:#fff;min-width:26px;min-height:26px}.leaflet-touch .leaflet-control-geocoder{min-width:30px;min-height:30px}.leaflet-control-geocoder .leaflet-control-geocoder-icon,.leaflet-control-geocoder a{border-bottom:none;display:inline-block}.leaflet-control-geocoder .leaflet-control-geocoder-alternatives a{width:inherit;height:inherit;line-height:inherit}.leaflet-control-geocoder .leaflet-control-geocoder-icon:hover,.leaflet-control-geocoder a:hover{border-bottom:none;display:inline-block}.leaflet-control-geocoder-form{display:none;vertical-align:middle}.leaflet-control-geocoder-expanded .leaflet-control-geocoder-form{display:inline-block}.leaflet-control-geocoder-form input{font-size:120%;border:0;background-color:transparent;width:246px}.leaflet-control-geocoder-icon{border-radius:4px;width:26px;height:26px;border:none;background-color:#fff;background-image:url('images/geocoder.png');background-repeat:no-repeat;background-position:center;cursor:pointer}.leaflet-touch .leaflet-control-geocoder-icon{width:30px;height:30px}.leaflet-control-geocoder-throbber .leaflet-control-geocoder-icon{background-image:url('images/throbber.gif')}.leaflet-control-geocoder-form-no-error{display:none}.leaflet-control-geocoder-form input:focus{outline:0}.leaflet-control-geocoder-form button{display:none}.leaflet-control-geocoder-error{margin-top:8px;margin-left:8px;display:block;color:#444}.leaflet-control-geocoder-alternatives{display:block;width:272px;list-style:none;padding:0;margin:0}.leaflet-control-geocoder-alternatives-minimized{display:none;height:0}.leaflet-control-geocoder-alternatives li{white-space:nowrap;display:block;overflow:hidden;padding:5px 8px;text-overflow:ellipsis;border-bottom:1px solid #ccc;cursor:pointer}.leaflet-control-geocoder-alternatives li a,.leaflet-control-geocoder-alternatives li a:hover{width:inherit;height:inherit;line-height:inherit;background:inherit;border-radius:inherit;text-align:left}.leaflet-control-geocoder-alternatives li:last-child{border-bottom:none}.leaflet-control-geocoder-alternatives li:hover,.leaflet-control-geocoder-selected{background-color:#f5f5f5}.leaflet-control-geocoder-address-context{color:#666}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

202
assets/control-geocoder/README.md Normal file → Executable file
View File

@@ -6,39 +6,51 @@ I strongly believe that it is my &mdash; and your &mdash; duty to make the open
While I can't force anyone to do anything, if you happen to disagree with this, I ask of you not to use any of the open source I have published. Nor am I interested in contributions from people who can't accept or act respectfully towards other humans regardless of gender identity, sexual orientation, disability, ethnicity, religion, age, physical appearance, body size, race, or similar personal characteristics. If you think feminism, anti-racism or the LGBT movement is somehow wrong, disturbing or irrelevant, I ask you to go elsewhere to find software.
Leaflet Control Geocoder [![NPM version](https://badge.fury.io/js/leaflet-control-geocoder.png)](http://badge.fury.io/js/leaflet-control-geocoder)
=============================
# Leaflet Control Geocoder [![NPM version](https://img.shields.io/npm/v/leaflet-control-geocoder.svg)](https://www.npmjs.com/package/leaflet-control-geocoder) ![Leaflet 1.0.0 compatible!](https://img.shields.io/badge/Leaflet%201.0.0-%E2%9C%93-1EB300.svg?style=flat)
A simple geocoder for [Leaflet](http://leafletjs.com/) that by default uses [OSM](http://www.openstreetmap.org/)/[Nominatim](http://wiki.openstreetmap.org/wiki/Nominatim).
A simple geocoder for [Leaflet](https://leafletjs.com/) that by default uses [OSM](https://www.openstreetmap.org/)/[Nominatim](https://wiki.openstreetmap.org/wiki/Nominatim).
The plugin supports many different data providers:
* [OSM](http://www.openstreetmap.org/)/[Nominatim](http://wiki.openstreetmap.org/wiki/Nominatim)
* [Bing Locations API](http://msdn.microsoft.com/en-us/library/ff701715.aspx)
* [Google Geocoding API](https://developers.google.com/maps/documentation/geocoding/)
* [Mapbox Geocoding](https://www.mapbox.com/developers/api/geocoding/)
* [MapQuest Geocoding API](http://developer.mapquest.com/web/products/dev-services/geocoding-ws)
* [RaveGeo](http://www2.idevio.com/ravegeo-server.html)
- LatLng to parse basic latitude/longitude strings
- [OSM](https://www.openstreetmap.org/)/[Nominatim](https://wiki.openstreetmap.org/wiki/Nominatim)
- [Bing Locations API](http://msdn.microsoft.com/en-us/library/ff701715.aspx)
- [Google Geocoding API](https://developers.google.com/maps/documentation/geocoding/)
- [Mapbox Geocoding](https://www.mapbox.com/api-documentation/#geocoding)
- [MapQuest Geocoding API](http://developer.mapquest.com/web/products/dev-services/geocoding-ws)
- [What3Words](http://what3words.com/)
- [Photon](http://photon.komoot.de/)
- [Pelias](https://pelias.io/), [geocode.earth](https://geocode.earth/) (formerly Mapzen Search), [Openrouteservice](https://openrouteservice.org/dev/#/api-docs/geocode)
- [HERE Geocoder API](https://developer.here.com/documentation/geocoder/topics/introduction.html)
- [Neutrino API](https://www.neutrinoapi.com/api/geocode-address/)
- [Plus codes](https://plus.codes/) (formerly OpenLocationCode) (requires [open-location-code](https://www.npmjs.com/package/open-location-code))
The plugin can easily be extended to support other providers.
The plugin can easily be extended to support other providers. Current extensions:
See the [Leaflet Control Geocoder Demo](http://perliedman.github.com/leaflet-control-geocoder/).
- [DAWA Geocoder](https://github.com/kjoller/leaflet-control-geocoder-dawa/tree/new) - support for Danish Address Web API by [Niels Kjøller Hansen](https://github.com/kjoller)
# Demos
- [Leaflet Control Geocoder Demo](https://www.liedman.net/leaflet-control-geocoder/) hosted on liedman.net
- See [demo/](https://github.com/perliedman/leaflet-control-geocoder/tree/master/demo)
- See [demo-rollup/](https://github.com/perliedman/leaflet-control-geocoder/tree/master/demo-rollup) using the [rollup.js](https://rollupjs.org/) bundler
- See [demo-webpack/](https://github.com/perliedman/leaflet-control-geocoder/tree/master/demo-rollup) using the [webpack](https://webpack.js.org/) bundler
# Usage
Load the CSS and Javascript:
[Download latest release](https://github.com/perliedman/leaflet-control-geocoder/releases), or obtain the latest release via [unpkg.com](https://unpkg.com/):
```HTML
<link rel="stylesheet" href="../Control.Geocoder.css" />
<script src="Control.Geocoder.js"></script>
<link rel="stylesheet" href="https://unpkg.com/leaflet-control-geocoder/dist/Control.Geocoder.css" />
<script src="https://unpkg.com/leaflet-control-geocoder/dist/Control.Geocoder.js"></script>
```
Add the control to a map instance:
```javascript
var map = L.map('map').setView([0, 0], 2);
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
L.tileLayer('https://{s}.tile.osm.org/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="https://osm.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
L.Control.geocoder().addTo(map);
```
@@ -46,23 +58,27 @@ L.Control.geocoder().addTo(map);
# Customizing
By default, when a geocoding result is found, the control will center the map on it and place
a marker at its location. This can be customized by overwriting the control's ```markGeocode```
function, to perform any action desired.
a marker at its location. This can be customized by listening to the control's `markgeocode`
event. To remove the control's default handler for marking a result, set the option
`defaultMarkGeocode` to `false`.
For example:
```javascript
var geocoder = L.Control.geocoder().addTo(map);
geocoder.markGeocode = function(result) {
var bbox = result.bbox;
L.polygon([
bbox.getSouthEast(),
bbox.getNorthEast(),
bbox.getNorthWest(),
bbox.getSouthWest()
var geocoder = L.Control.geocoder({
defaultMarkGeocode: false
})
.on('markgeocode', function(e) {
var bbox = e.geocode.bbox;
var poly = L.polygon([
bbox.getSouthEast(),
bbox.getNorthEast(),
bbox.getNorthWest(),
bbox.getSouthWest()
]).addTo(map);
};
map.fitBounds(poly.getBounds());
})
.addTo(map);
```
This will add a polygon representing the result's boundingbox when a result is selected.
@@ -75,71 +91,129 @@ This is the geocoder control. It works like any other Leaflet control, and is ad
### Constructor
This plugin supports the standard JavaScript constructor (to be invoked using `new`) as well as the [class factory methods](https://leafletjs.com/reference.html#class-class-factories) known from Leaflet:
```js
L.Control.Geocoder(options)
new L.Control.Geocoder(options);
// or
L.Control.geocoder(options);
```
### Options
| Option | Type | Default | Description |
| --------------- | ---------------- | ----------------- | ----------- |
| collapsed | Boolean | true | Collapse control unless hovered/clicked |
| position | String | "topright" | Control [position](http://leafletjs.com/reference.html#control-positions) |
| placeholder | String | "Search..." | Placeholder text for text input
| errorMessage | String | "Nothing found." | Message when no result found / geocoding error occurs |
| geocoder | IGeocoder | new L.Control.Geocoder.Nominatim() | Object to perform the actual geocoding queries |
| showResultIcons | Boolean | false | Show icons for geocoding results (if available); supported by Nominatim |
| Option | Type | Default | Description |
| ------------------ | --------- | ------------------------------------ | ------------------------------------------------------------------------------------------------------------- |
| `collapsed` | Boolean | `true` | Collapse control unless hovered/clicked |
| `expand` | String | `"touch"` | How to expand a collapsed control: `touch` or `click` or `hover` |
| `position` | String | `"topright"` | Control [position](https://leafletjs.com/reference.html#control-positions) |
| `placeholder` | String | `"Search..."` | Placeholder text for text input |
| `errorMessage` | String | `"Nothing found."` | Message when no result found / geocoding error occurs |
| `iconLabel` | String | `"Initiate a new search"` | Accessibility label for the search icon used by screen readers |
| `geocoder` | IGeocoder | `new L.Control.Geocoder.Nominatim()` | Object to perform the actual geocoding queries |
| `showUniqueResult` | Boolean | `true` | Immediately show the unique result without prompting for alternatives |
| `showResultIcons` | Boolean | `false` | Show icons for geocoding results (if available); supported by Nominatim |
| `suggestMinLength` | Number | `3` | Minimum number characters before suggest functionality is used (if available from geocoder) |
| `suggestTimeout` | Number | `250` | Number of milliseconds after typing stopped before suggest functionality is used (if available from geocoder) |
| `query` | String | `""` | Initial query string for text input |
| `queryMinLength` | Number | `1` | Minimum number of characters in search text before performing a query |
### Methods
| Method | Returns | Description |
| ------------------------------------- | ------------------- | ----------------- |
| markGeocode(<GeocodingResult> result) | this | Marks a geocoding result on the map |
| Method | Returns | Description |
| --------------------------------------- | ------- | --------------------------------------- |
| `markGeocode(<GeocodingResult> result)` | `this` | Marks a geocoding result on the map |
| `setQuery(<String> query)` | `this` | Sets the query string on the text input |
## L.Control.Geocoder.Nominatim
Uses [Nominatim](http://wiki.openstreetmap.org/wiki/Nominatim) to respond to geocoding queries. This is the default
geocoding service used by the control, unless otherwise specified in the options. Implements ```IGeocoder```.
Uses [Nominatim](https://wiki.openstreetmap.org/wiki/Nominatim) to respond to geocoding queries. This is the default
geocoding service used by the control, unless otherwise specified in the options. Implements `IGeocoder`.
Unless using your own Nominatim installation, please refer to the [Nominatim usage policy](http://wiki.openstreetmap.org/wiki/Nominatim_usage_policy).
Unless using your own Nominatim installation, please refer to the [Nominatim usage policy](https://operations.osmfoundation.org/policies/nominatim/).
### Constructor
```js
L.Control.Geocoder.Nominatim(options)
new L.Control.Geocoder.Nominatim(options);
// or
L.Control.Geocoder.nominatim(options);
```
## Options
### Options
| Option | Type | Default | Description |
| --------------- | ---------------- | ----------------- | ----------- |
| serviceUrl | String | "http://nominatim.openstreetmap.org/" | URL of the service |
| geocodingQueryParams | Object | {} | Additional URL parameters (strings) that will be added to geocoding requests; can be used to restrict results to a specific country for example, by providing the [`countrycodes`](http://wiki.openstreetmap.org/wiki/Nominatim#Parameters) parameter to Nominatim |
| reverseQueryParams | Object | {} | Additional URL parameters (strings) that will be added to reverse geocoding requests |
| htmlTemplate | function | special | A function that takes an GeocodingResult as argument and returns an HTML formatted string that represents the result. Default function breaks up address in parts from most to least specific, in attempt to increase readability compared to Nominatim's naming
| Option | Type | Default | Description |
| ---------------------- | -------- | ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `serviceUrl` | String | `"https://nominatim.openstreetmap.org/"` | URL of the service |
| `geocodingQueryParams` | Object | `{}` | Additional URL parameters (strings) that will be added to geocoding requests; can be used to restrict results to a specific country for example, by providing the [`countrycodes`](https://wiki.openstreetmap.org/wiki/Nominatim#Parameters) parameter to Nominatim |
| `reverseQueryParams` | Object | `{}` | Additional URL parameters (strings) that will be added to reverse geocoding requests |
| `htmlTemplate` | function | special | A function that takes an GeocodingResult as argument and returns an HTML formatted string that represents the result. Default function breaks up address in parts from most to least specific, in attempt to increase readability compared to Nominatim's naming |
## L.Control.Geocoder.Bing
Uses [Bing Locations API](http://msdn.microsoft.com/en-us/library/ff701715.aspx) to respond to geocoding queries. Implements ```IGeocoder```.
Uses [Bing Locations API](http://msdn.microsoft.com/en-us/library/ff701715.aspx) to respond to geocoding queries. Implements `IGeocoder`.
Note that you need an API key to use this service.
### Constructor
```ts
new L.Control.Geocoder.Bing(<String>key);
// or
L.Control.Geocoder.bing(<String>key);
```
L.Control.Geocoder.Bing(<String> key)
## L.Control.Geocoder.OpenCage
Uses [OpenCage Data API](https://opencagedata.com/) to respond to geocoding queries. Implements `IGeocoder`.
Note that you need an API key to use this service.
### Constructor
```ts
new L.Control.Geocoder.OpenCage(<String>key, options);
// or
L.Control.Geocoder.opencage(<String>key, options);
```
### Options
| Option | Type | Default | Description |
| ---------------------- | ------ | ------------------------------------------------ | ------------------------------------------------------------------------------------ |
| `serviceUrl` | String | `"https://api.opencagedata.com/geocode/v1/json"` | URL of the service |
| `geocodingQueryParams` | Object | `{}` | Additional URL parameters (strings) that will be added to geocoding requests |
| `reverseQueryParams` | Object | `{}` | Additional URL parameters (strings) that will be added to reverse geocoding requests |
## L.Control.Geocoder.LatLng
Parses basic latitude/longitude strings such as `'50.06773 14.37742'`, `'N50.06773 W14.37742'`, `'S 50° 04.064 E 014° 22.645'`, or `'S 50° 4 03.828″, W 14° 22 38.712″'`.
### Constructor
```ts
new L.Control.Geocoder.LatLng(options);
// or
L.Control.Geocoder.latLng(options);
```
### Options
| Option | Type | Default | Description |
| -------------- | --------- | ------- | --------------------------------------------------------- |
| `next` | IGeocoder | | The next geocoder to use for non-supported queries. |
| `sizeInMeters` | Number | 10000 | The size in meters used for passing to `LatLng.toBounds`. |
## IGeocoder
An interface implemented to respond to geocoding queries.
### Methods
| Method | Returns | Description |
| ------------------------------------- | ------------------- | ----------------- |
| geocode(<String> query, callback, context) | GeocodingResult[] | Performs a geocoding query and returns the results to the callback in the provided context |
| reverse(<L.LatLng> location, <Number> scale, callback, context) | GeocodingResult[] | Performs a reverse geocoding query and returns the results to the callback in the provided context |
| Method | Returns | Description |
| ----------------------------------------------------------------- | ------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| `geocode(<String> query, callback, context)` | `GeocodingResult[]` | Performs a geocoding query and returns the results to the callback in the provided context |
| `suggest(<String> query, callback, context)` | `GeocodingResult[]` | Performs a geocoding query suggestion (this happens while typing) and returns the results to the callback in the provided context |
| `reverse(<L.LatLng> location, <Number> scale, callback, context)` | `GeocodingResult[]` | Performs a reverse geocoding query and returns the results to the callback in the provided context |
## GeocodingResult
@@ -147,10 +221,10 @@ An object that represents a result from a geocoding query.
### Properties
| Property | Type | Description |
| ---------- | ---------------- | ------------------------------------- |
| name | String | Name of found location |
| bounds | L.LatLngBounds | The bounds of the location |
| center | L.LatLng | The center coordinate of the location |
| icon | String | URL for icon representing result; optional |
| html | String | (optional) HTML formatted representation of the name |
| Property | Type | Description |
| -------- | -------------- | ---------------------------------------------------- |
| `name` | String | Name of found location |
| `bbox` | L.LatLngBounds | The bounds of the location |
| `center` | L.LatLng | The center coordinate of the location |
| `icon` | String | URL for icon representing result; optional |
| `html` | String | (optional) HTML formatted representation of the name |

25
assets/control-geocoder/bower.json Normal file → Executable file
View File

@@ -1,12 +1,17 @@
{
"name": "leaflet-control-geocoder",
"version": "1.1.0",
"version": "1.5.5",
"homepage": "https://github.com/perliedman/leaflet-control-geocoder",
"authors": [
"Per Liedman <per@liedman.net>"
],
"description": "Extendable geocoder with builtin OSM/Nominatim support",
"main": "Control.Geocoder.js",
"main": [
"dist/Control.Geocoder.js",
"dist/Control.Geocoder.css",
"images/geocoder.png",
"images/throbber.gif"
],
"moduleType": [
"amd",
"globals"
@@ -14,7 +19,16 @@
"keywords": [
"leaflet",
"geocoder",
"nominatim"
"locations",
"nominatim",
"bing",
"google",
"mapbox",
"photon",
"what3words",
"mapquest",
"mapzen",
"here"
],
"license": "BSD-2-Clause",
"ignore": [
@@ -23,8 +37,5 @@
"bower_components",
"test",
"tests"
],
"dependencies": {
"leaflet": "~0.7.2"
}
]
}

View File

@@ -1,26 +1,87 @@
{
"name": "leaflet-control-geocoder",
"version": "1.1.0",
"description": "Extendable geocoder with builtin OSM/Nominatim support",
"main": "Control.Geocoder.js",
"version": "1.13.0",
"description": "Extendable geocoder with builtin support for OpenStreetMap Nominatim, Bing, Google, Mapbox, MapQuest, What3Words, Photon, Pelias, HERE, Neutrino, Plus codes",
"main": "dist/Control.Geocoder.js",
"module": "src/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"prepare": "npm run build",
"build": "npm run build:js && npm run build:css && npm run build:img && npm run build:demo-rollup && npm run build:demo-webpack",
"build:js": "rollup -c",
"build:css": "cpr Control.Geocoder.css dist/Control.Geocoder.css --overwrite",
"build:img": "cpr images/ dist/images/ --overwrite",
"build:demo-rollup": "cd demo-rollup && npm install && npm run build",
"build:demo-webpack": "cd demo-rollup && npm install && npm run build",
"test": "npm run test:karma -- --single-run && npm run lint",
"test:karma": "karma start spec/karma.conf.js",
"lint": "npm run lint:js && npm run lint:style",
"lint:js": "eslint .",
"lint:style": "prettier --check $(npm run ls-files)",
"fix:style": "prettier --write $(npm run ls-files)",
"ls-files": "git ls-files '*.js' '*.json' '*.css' '*.html' '*.yaml' '*.yml' '*.md'"
},
"repository": {
"type": "git",
"url": "git://github.com/perliedman/leaflet-control-geocoder.git"
},
"files": [
"LICENCE",
"dist/**",
"demo/**",
"images/**",
"src/**",
"*.css"
],
"keywords": [
"leaflet",
"geocoder",
"nominatim"
"locations",
"openstreetmap",
"nominatim",
"bing",
"bingmaps",
"googlemaps",
"google-maps",
"mapbox",
"mapquest",
"opencage",
"what3words",
"photon",
"mapzen",
"pelias",
"here",
"neutrino",
"pluscodes",
"open location code"
],
"author": "Per Liedman <per@liedman.net>",
"contributors": [
"Simon Legner <Simon.Legner@gmail.com>"
],
"license": "BSD-2-Clause",
"bugs": {
"url": "https://github.com/perliedman/leaflet-control-geocoder/issues"
},
"dependencies": {
"leaflet": "~0.7.2"
"dependencies": {},
"devDependencies": {
"cpr": "^3.0.1",
"eslint": "^6.8.0",
"eslint-plugin-prettier": "^3.1.2",
"karma": "^4.4.1",
"karma-expect": "^1.1.3",
"karma-mocha": "^1.3.0",
"karma-phantomjs-launcher": "^1.0.4",
"karma-sinon": "^1.0.5",
"leaflet": "^1.6.0",
"mocha": "^6.2.2",
"phantomjs-prebuilt": "^2.1.16",
"prettier": "^1.19.1",
"rollup": "^0.65.2",
"rollup-plugin-uglify": "^5.0.2",
"sinon": "^7.5.0",
"uglify-js": "^3.7.5"
},
"optionalDependencies": {
"open-location-code": "^1.0.0"
}
}

60
assets/leaflet-extra-markers/.gitignore vendored Normal file
View File

@@ -0,0 +1,60 @@
### General Ignores ###
.idea
*~
### Operating System Ignores ###
# Windows image file caches
Thumbs.db
ehthumbs.db
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msm
*.msp
# Windows shortcuts
*.lnk
# OSX
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
###Node###
# Logs
logs
*.log
# Runtime data
pids
*.pid
*.seed
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Dependency directory
# Commenting this out is preferred by some people, see
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git-
node_modules
# Users Environment Variables
.lock-wscript

View File

@@ -0,0 +1,66 @@
module.exports = function(grunt) {
'use strict';
// require it at the top and pass in the grunt instance
require('time-grunt')(grunt);
/*****************************************************
Grunt Init Config:
load each task config into grunt via require
*****************************************************/
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
// Project Config
project: require('./build/grunt-config/project'), // Contains paths and banner
less: require('./build/grunt-config/less'), // Config to compile and autoprefix less files
uglify: require('./build/grunt-config/uglify'),
jshint: require('./build/grunt-config/jshint'), // Lint Javascript
rollup: require('./build/grunt-config/rollup-config')
});
/*****************************************************
Dev Tasks - Compile and check files withing the /src/assets/ directory
*****************************************************/
// Default grunt task compiles & checks dev files
grunt.registerTask('default', [], function(){
grunt.loadNpmTasks('grunt-contrib-less');
grunt.task.run('less:dev','js-dev');
});
// Javascript Dev Build - Checks for Errors in Javascript
grunt.registerTask('js-dev', [], function(){
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-rollup');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.task.run('jshint:all', 'rollup', 'uglify:build');
});
/*****************************************************
Dist Tasks
*****************************************************/
// 'grunt build' global build command for both less and js files
grunt.registerTask('build', 'Compiles all files for live environment', function() {
grunt.loadNpmTasks('grunt-contrib-less');
grunt.task.run('less:build', 'js-build');
});
// 'grunt js-build' compiles only javascript
grunt.registerTask('js-build', [], function(){
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-rollup');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.task.run('jshint:all', 'rollup', 'uglify:build');
});
// 'grunt less-build' compiles only less
grunt.registerTask('less-build', [], function(){
grunt.loadNpmTasks('grunt-contrib-less');
grunt.task.run('less:build');
});
};

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2014 coryasilva
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,83 @@
# Leaflet.extra-markers
<a href="https://github.com/lvoogdt/Leaflet.awesome-markers">Big Thanks to lvoogdt of Leaflet.awesome-markers</a>
![ExtraMarkers screenshot](https://raw.github.com/coryasilva/Leaflet.ExtraMarkers/master/screenshot.png "Screenshot of ExtraMarkers")
**<a href="http://coryasilva.github.io/Leaflet.ExtraMarkers/" target="_blank">Demo</a>**
## Icons
Leaflet.extra-markers is designed for:
- [Bootstrap 3 icons](http://twitter.github.com/bootstrap/)
- [Font Awesome 4.x](http://fortawesome.github.com/Font-Awesome/)
- [Font Awesome 5.x](http://fortawesome.github.com/Font-Awesome/)
- [Semantic UI 2.x icons](http://semantic-ui.com/)
- [Ion Icons 2.x](http://ionicons.com/)
- Leaflet 0.5-Latest
## Using the plugin
### 1. Requirements
Follow the [getting started guide](#icons) for the desired font library and make sure its included in your project.
### 2. Installing Leaflet.extra-markers
Next, copy the `dist/img` directory, `/dist/css/leaflet.extra-markers.min.css`, and `/dist/js/leaflet.extra-markers.min.js` to your project and include them:
````xml
<link rel="stylesheet" href="css/leaflet.extra-markers.min.css">
````
or
````less
@import 'bower_components/src/assets/less/Leaflet.extra-markers.less
````
and
````xml
<script src="js/leaflet.extra-markers.min.js"></script>
````
### 3. Creating a Marker
Now use the plugin to create a marker like this:
````js
// Creates a red marker with the coffee icon
var redMarker = L.ExtraMarkers.icon({
icon: 'fa-coffee',
markerColor: 'red',
shape: 'square',
prefix: 'fa'
});
L.marker([51.941196,4.512291], {icon: redMarker}).addTo(map);
````
---
## Properties
| Property | Description | Default Value | Possible values |
| --------------- | ------------------------------------------- | ------------- | ---------------------------------------------------- |
| extraClasses | Additional classes in the created `<i>` tag | `''` | `fa-rotate90 myclass`; space delimited classes to add |
| icon | Name of the icon **with** prefix | `''` | `fa-coffee` (see icon library's documentation) |
| iconColor | Color of the icon | `'white'` | `'white'`, `'black'` or css code (hex, rgba etc) |
| iconRotation | Rotates the icon with css transformations | `0` | numeric degrees
| innerHTML | Custom HTML code | `''` | `<svg>`, images, or other HTML; a truthy assignment will override the default html icon creation behavior |
| markerColor | Color of the marker (css class) | `'blue'` | `'red'`, `'orange-dark'`, `'orange'`, `'yellow'`, `'blue-dark'`, `'cyan'`, `'purple'`, `'violet'`, `'pink'`, `'green-dark'`, `'green'`, `'green-light'`, `'black'`, `'white'`, or color hex code **if `svg` is true** |
| number | Instead of an icon, define a plain text | `''` | `'1'` or `'A'`, must set `icon: 'fa-number'` |
| prefix | The icon library's base class | `'glyphicon'` | `fa` (see icon library's documentation) |
| shape | Shape of the marker (css class) | `'circle'` | `'circle'`, `'square'`, `'star'`, or `'penta'` |
| svg | Use SVG version | `false` | true or false
| svgBorderColor | (DEPRECATED has not effect) | `'#fff'` | any valid hex color
| svgOpacity | (DEPRECATED has not effect) | `1` | decimal range from 0 to 1
## License
- Leaflet.ExtraMarkers and colored markers are licensed under the MIT License - http://opensource.org/licenses/mit-license.html.

View File

@@ -0,0 +1,30 @@
{
"name": "Leaflet.extra-markers",
"version": "1.2.1",
"homepage": "https://github.com/coryasilva/Leaflet.ExtraMarkers",
"authors": [
"Cory Silva"
],
"description": "Custom Markers for Leaflet JS based on Awesome Markers",
"main": [
"src/assets/css/leaflet.extra-markers.css",
"src/assets/less/leaflet.extra-markers.less",
"src/assets/js/leaflet.extra-markers.js"
],
"license": "MIT",
"ignore": [
"gh-pages",
".bowerrc",
".gitignore",
".jshintignore",
".jshintrc",
"bower.json",
"gruntfile.js",
"package.json",
"README.md"
],
"dependencies": {
},
"devDependencies": {
}
}

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 248 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 535 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -0,0 +1,154 @@
/*!
* leaflet-extra-markers
* Custom Markers for Leaflet JS based on Awesome Markers
* Leaflet ExtraMarkers
* https://github.com/coryasilva/Leaflet.ExtraMarkers/
* @author coryasilva <https://github.com/coryasilva>
* @version 1.2.1
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(factory((global.leaflet = global.leaflet || {}, global.leaflet['extra-markers'] = {})));
}(this, (function (exports) { 'use strict';
var ExtraMarkers = L.ExtraMarkers = {};
ExtraMarkers.version = L.ExtraMarkers.version = "1.2.1";
ExtraMarkers.Icon = L.ExtraMarkers.Icon = L.Icon.extend({
options: {
iconSize: [ 35, 45 ],
iconAnchor: [ 17, 42 ],
popupAnchor: [ 1, -32 ],
shadowAnchor: [ 10, 12 ],
shadowSize: [ 36, 16 ],
className: "",
prefix: "",
extraClasses: "",
shape: "circle",
icon: "",
innerHTML: "",
markerColor: "red",
svgBorderColor: "#fff",
svgOpacity: 1,
iconColor: "#fff",
iconRotate: 0,
number: "",
svg: false
},
initialize: function(options) {
options = L.Util.setOptions(this, options);
},
createIcon: function() {
var div = document.createElement("div"), options = this.options;
if (options.icon) {
div.innerHTML = this._createInner();
}
if (options.innerHTML) {
div.innerHTML = options.innerHTML;
}
if (options.bgPos) {
div.style.backgroundPosition = -options.bgPos.x + "px " + -options.bgPos.y + "px";
}
if (!options.svg) {
this._setIconStyles(div, options.shape + "-" + options.markerColor);
} else {
this._setIconStyles(div, "svg");
}
return div;
},
_getColorHex: function (color) {
var colorMap = {
red: "#a23337",
"orange-dark": "#d73e29",
orange: "#ef9227",
yellow: "#f5bb39",
"blue-dark": "#276273",
cyan: "#32a9dd",
purple: "#440444",
violet: "#90278d",
pink: "#c057a0",
green: "#006838",
white: "#e8e8e8",
black: "#211c1d"
};
return colorMap[color] || color;
},
_createSvg: function (shape, markerColor) {
var svgMap = {
circle: '<svg width="32" height="44" viewBox="0 0 35 45" xmlns="http://www.w3.org/2000/svg"><path d="M17.5 2.746c-8.284 0-15 6.853-15 15.307 0 .963.098 1.902.265 2.816a15.413 15.413 0 002.262 5.684l.134.193 12.295 17.785 12.439-17.863.056-.08a15.422 15.422 0 002.343-6.112c.123-.791.206-1.597.206-2.423 0-8.454-6.716-15.307-15-15.307" fill="' + markerColor + '" /><path d="M17.488 2.748c-8.284 0-15 6.853-15 15.307 0 .963.098 1.902.265 2.816a15.413 15.413 0 002.262 5.684l.134.193 12.295 17.785 12.44-17.863.055-.08a15.422 15.422 0 002.343-6.112c.124-.791.206-1.597.206-2.423 0-8.454-6.716-15.307-15-15.307m0 1.071c7.68 0 13.929 6.386 13.929 14.236 0 .685-.064 1.423-.193 2.258-.325 2.075-1.059 3.99-2.164 5.667l-.055.078-11.557 16.595L6.032 26.14l-.12-.174a14.256 14.256 0 01-2.105-5.29 14.698 14.698 0 01-.247-2.62c0-7.851 6.249-14.237 13.928-14.237" fill="#231f20" opacity=".15" /></svg>',
square: '<svg width="33" height="44" viewBox="0 0 35 45" xmlns="http://www.w3.org/2000/svg"><path d="M28.205 3.217H6.777c-2.367 0-4.286 1.87-4.286 4.179v19.847c0 2.308 1.919 4.179 4.286 4.179h5.357l5.337 13.58 5.377-13.58h5.357c2.366 0 4.285-1.87 4.285-4.179V7.396c0-2.308-1.919-4.179-4.285-4.179" fill="' + markerColor + '" /><g opacity=".15" transform="matrix(1.0714 0 0 -1.0714 -233.22 146.783)"><path d="M244 134h-20c-2.209 0-4-1.746-4-3.9v-18.525c0-2.154 1.791-3.9 4-3.9h5L233.982 95 239 107.675h5c2.209 0 4 1.746 4 3.9V130.1c0 2.154-1.791 3.9-4 3.9m0-1c1.654 0 3-1.301 3-2.9v-18.525c0-1.599-1.346-2.9-3-2.9h-5.68l-.25-.632-4.084-10.318-4.055 10.316-.249.634H224c-1.654 0-3 1.301-3 2.9V130.1c0 1.599 1.346 2.9 3 2.9h20" fill="#231f20" /></g></svg>',
star: '<svg width="34" height="44" viewBox="0 0 35 45" xmlns="http://www.w3.org/2000/svg"><path d="M32.92 16.93l-3.525-3.525V8.419a1.983 1.983 0 00-1.983-1.982h-4.985L18.9 2.91a1.984 1.984 0 00-2.803 0l-3.524 3.526H7.588a1.983 1.983 0 00-1.982 1.982v4.986L2.081 16.93a1.982 1.982 0 000 2.803l3.525 3.526v4.984c0 1.096.888 1.983 1.982 1.983h4.986L17.457 45l4.97-14.773h4.985a1.983 1.983 0 001.983-1.983V23.26l3.525-3.526a1.982 1.982 0 000-2.803" fill="' + markerColor + '" /><g opacity=".15" transform="matrix(1.0667 0 0 -1.0667 -347.3 97.26)"><path d="M342 89c-.476 0-.951-.181-1.314-.544l-3.305-3.305h-4.673a1.858 1.858 0 01-1.859-1.858v-4.674l-3.305-3.305a1.857 1.857 0 010-2.627l3.305-3.305v-4.674a1.86 1.86 0 011.859-1.859h4.673L341.959 49l4.659 13.849h4.674a1.86 1.86 0 011.859 1.859v4.674l3.305 3.305a1.858 1.858 0 010 2.627l-3.305 3.305v4.674a1.859 1.859 0 01-1.859 1.858h-4.674l-3.304 3.305A1.851 1.851 0 01342 89m0-1a.853.853 0 00.607-.251l3.304-3.305.293-.293h5.088a.86.86 0 00.859-.858v-5.088l3.598-3.598A.852.852 0 00356 74a.85.85 0 00-.251-.606l-3.598-3.598v-5.088a.86.86 0 00-.859-.859h-5.393l-.229-.681-3.702-11.006-3.637 11.001-.227.686h-5.396a.86.86 0 00-.859.859v5.088l-3.598 3.598c-.162.162-.251.377-.251.606s.089.445.251.607l3.598 3.598v5.088a.86.86 0 00.859.858h5.087l3.598 3.598A.853.853 0 00342 88" fill="#231f20" /></g></svg>',
penta: '<svg width="33" height="44" viewBox="0 0 35 45" xmlns="http://www.w3.org/2000/svg"><path d="M1.872 17.35L9.679 2.993h15.615L33.1 17.35 17.486 44.992z" fill="' + markerColor + '" /><g opacity=".15" transform="matrix(1.0769 0 0 -1.0769 -272.731 48.23)"><path d="M276.75 42h-14.5L255 28.668 269.5 3 284 28.668zm-.595-1l6.701-12.323L269.5 5.033l-13.356 23.644L262.845 41z" fill="#231f20" /></g></svg>'
};
return svgMap[shape];
},
_createInner: function() {
var iconStyle = "", iconNumber = "", iconClass = "", result = "", options = this.options;
if (options.iconColor) {
iconStyle = "color: " + options.iconColor + ";";
}
if (options.iconRotate !== 0) {
iconStyle += "-webkit-transform: rotate(" + options.iconRotate + "deg);";
iconStyle += "-moz-transform: rotate(" + options.iconRotate + "deg);";
iconStyle += "-o-transform: rotate(" + options.iconRotate + "deg);";
iconStyle += "-ms-transform: rotate(" + options.iconRotate + "deg);";
iconStyle += "transform: rotate(" + options.iconRotate + "deg);";
}
if (options.number) {
iconNumber = 'number="' + options.number + '" ';
}
if (options.extraClasses.length) {
iconClass += options.extraClasses + " ";
}
if (options.prefix.length) {
iconClass += options.prefix + " ";
}
if (options.icon.length) {
iconClass += options.icon + " ";
}
if (options.svg) {
result += this._createSvg(options.shape, this._getColorHex(options.markerColor));
}
result += '<i ' + iconNumber + 'style="' + iconStyle + '" class="' + iconClass + '"></i>';
return result;
},
_setIconStyles: function(img, name) {
var options = this.options, size = L.point(options[name === "shadow" ? "shadowSize" : "iconSize"]), anchor, leafletName;
if (name === "shadow") {
anchor = L.point(options.shadowAnchor || options.iconAnchor);
leafletName = "shadow";
} else {
anchor = L.point(options.iconAnchor);
leafletName = "icon";
}
if (!anchor && size) {
anchor = size.divideBy(2, true);
}
img.className = "leaflet-marker-" + leafletName + " extra-marker extra-marker-" + name + " " + options.className;
if (anchor) {
img.style.marginLeft = -anchor.x + "px";
img.style.marginTop = -anchor.y + "px";
}
if (size) {
img.style.width = size.x + "px";
img.style.height = size.y + "px";
}
},
createShadow: function() {
var div = document.createElement("div");
this._setIconStyles(div, "shadow");
return div;
}
});
ExtraMarkers.icon = L.ExtraMarkers.icon = function(options) {
return new L.ExtraMarkers.Icon(options);
};
exports.ExtraMarkers = ExtraMarkers;
Object.defineProperty(exports, '__esModule', { value: true });
})));
//# sourceMappingURL=leaflet.extra-markers.js.map

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,40 @@
import * as L from "leaflet";
declare module "leaflet" {
export namespace ExtraMarkers {
export interface IconOptions extends L.BaseIconOptions {
/** Additional classes in the created <i> tag. */
extraClasses?: string;
/** Name of the icon with prefix. */
icon?: string;
/** Color of the icon. Default value 'white'. */
iconColor?: string;
/** Rotates the icon with css transformations. Default value 0. */
iconRotation?: number;
/** Custom HTML code. */
innerHTML?: string;
/** Color of the marker (css class). Default value 'blue'. */
markerColor?: "red" | "orange-dark" | "orange" | "yellow" | "blue" | "blue-dark" | "cyan" | "purple"
| "violet" | "pink" | "green-dark" | "green" | "green-light" | "black" | "white";
/** Instead of an icon, define a plain text. */
number?: string;
/** The icon library's base class. Default value 'glyphicon'. */
prefix?: string;
/** Shape of the marker (css class). Default value 'circle'. */
shape?: "circle" | "square" | "star" | "penta";
/** Use SVG version of marker. Default value false. */
svg?: boolean;
/** DEPRECATED No Effect. Default value '#fff'. */
svgBorderColor?: string;
/** DEPRECATED: No effect. Default value 1. */
svgOpacity?: number;
}
export class Icon extends L.Icon {
constructor(options: IconOptions)
}
export function icon(options: IconOptions): Icon;
}
}

View File

@@ -0,0 +1,32 @@
{
"name": "leaflet-extra-markers",
"title": "Leaflet ExtraMarkers",
"url": "https://github.com/coryasilva/Leaflet.ExtraMarkers/",
"version": "1.2.1",
"description": "Custom Markers for Leaflet JS based on Awesome Markers",
"author": "coryasilva <https://github.com/coryasilva>",
"repository": {
"type": "git",
"url": "https://github.com/coryasilva/Leaflet.ExtraMarkers"
},
"main": "dist/js/leaflet.extra-markers.js",
"types": "dist/leaflet.extra-markers.d.ts",
"scripts": {
"start": "grunt",
"build": "grunt build"
},
"peerDependencies": {
"leaflet": ">= 0.5 < 2"
},
"devDependencies": {
"git-rev-sync": "^1.12.0",
"grunt": "^1.0.4",
"grunt-contrib-jshint": "^1.1.0",
"grunt-contrib-less": "^1.4.1",
"grunt-contrib-uglify": "^3.4.0",
"grunt-rollup": "^9.0.0",
"less-plugin-autoprefix": "^1.5.1",
"rollup-plugin-git-version": "^0.3.1",
"time-grunt": "^1.4.0"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

View File

@@ -26,32 +26,53 @@ L.Control.FullScreen = L.Control.extend({
}
this._createButton(this.options.title, className, content, container, this.toggleFullScreen, this);
this._map.fullscreenControl = this;
this._map.on('enterFullscreen exitFullscreen', this._toggleTitle, this);
return container;
},
onRemove: function (map) {
L.DomEvent
.off(this.link, 'click', L.DomEvent.stopPropagation)
.off(this.link, 'click', L.DomEvent.preventDefault)
.off(this.link, 'click', this.toggleFullScreen, this);
L.DomEvent
.off(this._container, fullScreenApi.fullScreenEventName, L.DomEvent.stopPropagation)
.off(this._container, fullScreenApi.fullScreenEventName, L.DomEvent.preventDefault)
.off(this._container, fullScreenApi.fullScreenEventName, this._handleFullscreenChange, this);
L.DomEvent
.off(document, fullScreenApi.fullScreenEventName, L.DomEvent.stopPropagation)
.off(document, fullScreenApi.fullScreenEventName, L.DomEvent.preventDefault)
.off(document, fullScreenApi.fullScreenEventName, this._handleFullscreenChange, this);
},
_createButton: function (title, className, content, container, fn, context) {
this.link = L.DomUtil.create('a', className, container);
this.link.href = '#';
this.link.title = title;
this.link.innerHTML = content;
this.link.setAttribute('role', 'button');
this.link.setAttribute('aria-label', title);
L.DomEvent
.addListener(this.link, 'click', L.DomEvent.stopPropagation)
.addListener(this.link, 'click', L.DomEvent.preventDefault)
.addListener(this.link, 'click', fn, context);
.on(this.link, 'click', L.DomEvent.stopPropagation)
.on(this.link, 'click', L.DomEvent.preventDefault)
.on(this.link, 'click', fn, context);
L.DomEvent
.addListener(container, fullScreenApi.fullScreenEventName, L.DomEvent.stopPropagation)
.addListener(container, fullScreenApi.fullScreenEventName, L.DomEvent.preventDefault)
.addListener(container, fullScreenApi.fullScreenEventName, this._handleEscKey, context);
.on(container, fullScreenApi.fullScreenEventName, L.DomEvent.stopPropagation)
.on(container, fullScreenApi.fullScreenEventName, L.DomEvent.preventDefault)
.on(container, fullScreenApi.fullScreenEventName, this._handleFullscreenChange, context);
L.DomEvent
.addListener(document, fullScreenApi.fullScreenEventName, L.DomEvent.stopPropagation)
.addListener(document, fullScreenApi.fullScreenEventName, L.DomEvent.preventDefault)
.addListener(document, fullScreenApi.fullScreenEventName, this._handleEscKey, context);
.on(document, fullScreenApi.fullScreenEventName, L.DomEvent.stopPropagation)
.on(document, fullScreenApi.fullScreenEventName, L.DomEvent.preventDefault)
.on(document, fullScreenApi.fullScreenEventName, this._handleFullscreenChange, context);
return this.link;
},
@@ -61,11 +82,10 @@ L.Control.FullScreen = L.Control.extend({
map._exitFired = false;
if (map._isFullscreen) {
if (fullScreenApi.supportsFullScreen && !this.options.forcePseudoFullscreen) {
fullScreenApi.cancelFullScreen(this.options.fullscreenElement ? this.options.fullscreenElement : map._container);
fullScreenApi.cancelFullScreen();
} else {
L.DomUtil.removeClass(map._container, 'leaflet-pseudo-fullscreen');
L.DomUtil.removeClass(this.options.fullscreenElement ? this.options.fullscreenElement : map._container, 'leaflet-pseudo-fullscreen');
}
map.invalidateSize();
map.fire('exitFullscreen');
map._exitFired = true;
map._isFullscreen = false;
@@ -74,9 +94,8 @@ L.Control.FullScreen = L.Control.extend({
if (fullScreenApi.supportsFullScreen && !this.options.forcePseudoFullscreen) {
fullScreenApi.requestFullScreen(this.options.fullscreenElement ? this.options.fullscreenElement : map._container);
} else {
L.DomUtil.addClass(map._container, 'leaflet-pseudo-fullscreen');
L.DomUtil.addClass(this.options.fullscreenElement ? this.options.fullscreenElement : map._container, 'leaflet-pseudo-fullscreen');
}
map.invalidateSize();
map.fire('enterFullscreen');
map._isFullscreen = true;
}
@@ -86,9 +105,10 @@ L.Control.FullScreen = L.Control.extend({
this.link.title = this._map._isFullscreen ? this.options.title : this.options.titleCancel;
},
_handleEscKey: function () {
_handleFullscreenChange: function () {
var map = this._map;
if (!fullScreenApi.isFullScreen(map) && !map._exitFired) {
map.invalidateSize();
if (!fullScreenApi.isFullScreen() && !map._exitFired) {
map.fire('exitFullscreen');
map._exitFired = true;
map._isFullscreen = false;
@@ -96,10 +116,15 @@ L.Control.FullScreen = L.Control.extend({
}
});
L.Map.include({
toggleFullscreen: function () {
this.fullscreenControl.toggleFullScreen();
}
});
L.Map.addInitHook(function () {
if (this.options.fullscreenControl) {
this.fullscreenControl = L.control.fullscreen(this.options.fullscreenControlOptions);
this.addControl(this.fullscreenControl);
this.addControl(L.control.fullscreen(this.options.fullscreenControlOptions));
}
});
@@ -155,7 +180,7 @@ source : http://johndyer.name/native-fullscreen-javascript-api-plus-jquery-plugi
fullScreenApi.isFullScreen = function () {
switch (this.prefix) {
case '':
return document.fullScreen;
return document.fullscreen;
case 'webkit':
return document.webkitIsFullScreen;
case 'ms':

View File

@@ -1 +1 @@
.leaflet-container:full-screen,.leaflet-pseudo-fullscreen{width:100%!important;height:100%!important;z-index:99999}.fullscreen-icon{background-image:url('icon-fullscreen.png')}.leaflet-retina .fullscreen-icon{background-image:url('icon-fullscreen-2x.png');background-size:26px 26px}.leaflet-container:-webkit-full-screen{width:100%!important;height:100%!important;z-index:99999}.leaflet-container:-ms-fullscreen{width:100%!important;height:100%!important;z-index:99999}.leaflet-container:fullscreen{width:100%!important;height:100%!important;z-index:99999}.leaflet-pseudo-fullscreen{position:fixed!important;top:0!important;left:0!important}
.fullscreen-icon{background-image:url('icon-fullscreen.png')}.leaflet-retina .fullscreen-icon{background-image:url('icon-fullscreen-2x.png');background-size:26px 26px}.leaflet-container:-webkit-full-screen{width:100%!important;height:100%!important;z-index:99999}.leaflet-container:-ms-fullscreen{width:100%!important;height:100%!important;z-index:99999}.leaflet-container:full-screen{width:100%!important;height:100%!important;z-index:99999}.leaflet-container:fullscreen{width:100%!important;height:100%!important;z-index:99999}.leaflet-pseudo-fullscreen{position:fixed!important;width:100%!important;height:100%!important;top:0!important;left:0!important;z-index:99999}

View File

@@ -1 +1 @@
!function(){L.Control.FullScreen=L.Control.extend({options:{position:"topleft",title:"Full Screen",titleCancel:"Exit Full Screen",forceSeparateButton:!1,forcePseudoFullscreen:!1,fullscreenElement:!1},onAdd:function(e){var n,t="leaflet-control-zoom-fullscreen",l="";return n=e.zoomControl&&!this.options.forceSeparateButton?e.zoomControl._container:L.DomUtil.create("div","leaflet-bar"),this.options.content?l=this.options.content:t+=" fullscreen-icon",this._createButton(this.options.title,t,l,n,this.toggleFullScreen,this),this._map.on("enterFullscreen exitFullscreen",this._toggleTitle,this),n},_createButton:function(n,t,l,r,i,s){return this.link=L.DomUtil.create("a",t,r),this.link.href="#",this.link.title=n,this.link.innerHTML=l,L.DomEvent.addListener(this.link,"click",L.DomEvent.stopPropagation).addListener(this.link,"click",L.DomEvent.preventDefault).addListener(this.link,"click",i,s),L.DomEvent.addListener(r,e.fullScreenEventName,L.DomEvent.stopPropagation).addListener(r,e.fullScreenEventName,L.DomEvent.preventDefault).addListener(r,e.fullScreenEventName,this._handleEscKey,s),L.DomEvent.addListener(document,e.fullScreenEventName,L.DomEvent.stopPropagation).addListener(document,e.fullScreenEventName,L.DomEvent.preventDefault).addListener(document,e.fullScreenEventName,this._handleEscKey,s),this.link},toggleFullScreen:function(){var n=this._map;n._exitFired=!1,n._isFullscreen?(e.supportsFullScreen&&!this.options.forcePseudoFullscreen?e.cancelFullScreen(this.options.fullscreenElement?this.options.fullscreenElement:n._container):L.DomUtil.removeClass(n._container,"leaflet-pseudo-fullscreen"),n.invalidateSize(),n.fire("exitFullscreen"),n._exitFired=!0,n._isFullscreen=!1):(e.supportsFullScreen&&!this.options.forcePseudoFullscreen?e.requestFullScreen(this.options.fullscreenElement?this.options.fullscreenElement:n._container):L.DomUtil.addClass(n._container,"leaflet-pseudo-fullscreen"),n.invalidateSize(),n.fire("enterFullscreen"),n._isFullscreen=!0)},_toggleTitle:function(){this.link.title=this._map._isFullscreen?this.options.title:this.options.titleCancel},_handleEscKey:function(){var n=this._map;e.isFullScreen(n)||n._exitFired||(n.fire("exitFullscreen"),n._exitFired=!0,n._isFullscreen=!1)}}),L.Map.addInitHook(function(){this.options.fullscreenControl&&(this.fullscreenControl=L.control.fullscreen(this.options.fullscreenControlOptions),this.addControl(this.fullscreenControl))}),L.control.fullscreen=function(e){return new L.Control.FullScreen(e)};var e={supportsFullScreen:!1,isFullScreen:function(){return!1},requestFullScreen:function(){},cancelFullScreen:function(){},fullScreenEventName:"",prefix:""},n="webkit moz o ms khtml".split(" ");if("undefined"!=typeof document.exitFullscreen)e.supportsFullScreen=!0;else{for(var t=0,l=n.length;t<l;t++)if(e.prefix=n[t],"undefined"!=typeof document[e.prefix+"CancelFullScreen"]){e.supportsFullScreen=!0;break}"undefined"!=typeof document.msExitFullscreen&&(e.prefix="ms",e.supportsFullScreen=!0)}e.supportsFullScreen&&("ms"===e.prefix?e.fullScreenEventName="MSFullscreenChange":e.fullScreenEventName=e.prefix+"fullscreenchange",e.isFullScreen=function(){switch(this.prefix){case"":return document.fullScreen;case"webkit":return document.webkitIsFullScreen;case"ms":return document.msFullscreenElement;default:return document[this.prefix+"FullScreen"]}},e.requestFullScreen=function(e){switch(this.prefix){case"":return e.requestFullscreen();case"ms":return e.msRequestFullscreen();default:return e[this.prefix+"RequestFullScreen"]()}},e.cancelFullScreen=function(){switch(this.prefix){case"":return document.exitFullscreen();case"ms":return document.msExitFullscreen();default:return document[this.prefix+"CancelFullScreen"]()}}),"undefined"!=typeof jQuery&&(jQuery.fn.requestFullScreen=function(){return this.each(function(){var n=jQuery(this);e.supportsFullScreen&&e.requestFullScreen(n)})}),window.fullScreenApi=e}();
!function(){L.Control.FullScreen=L.Control.extend({options:{position:"topleft",title:"Full Screen",titleCancel:"Exit Full Screen",forceSeparateButton:!1,forcePseudoFullscreen:!1,fullscreenElement:!1},onAdd:function(e){var n="leaflet-control-zoom-fullscreen",t="",e=e.zoomControl&&!this.options.forceSeparateButton?e.zoomControl._container:L.DomUtil.create("div","leaflet-bar");return this.options.content?t=this.options.content:n+=" fullscreen-icon",this._createButton(this.options.title,n,t,e,this.toggleFullScreen,this),(this._map.fullscreenControl=this)._map.on("enterFullscreen exitFullscreen",this._toggleTitle,this),e},onRemove:function(e){L.DomEvent.off(this.link,"click",L.DomEvent.stopPropagation).off(this.link,"click",L.DomEvent.preventDefault).off(this.link,"click",this.toggleFullScreen,this),L.DomEvent.off(this._container,i.fullScreenEventName,L.DomEvent.stopPropagation).off(this._container,i.fullScreenEventName,L.DomEvent.preventDefault).off(this._container,i.fullScreenEventName,this._handleFullscreenChange,this),L.DomEvent.off(document,i.fullScreenEventName,L.DomEvent.stopPropagation).off(document,i.fullScreenEventName,L.DomEvent.preventDefault).off(document,i.fullScreenEventName,this._handleFullscreenChange,this)},_createButton:function(e,n,t,l,r,o){return this.link=L.DomUtil.create("a",n,l),this.link.href="#",this.link.title=e,this.link.innerHTML=t,this.link.setAttribute("role","button"),this.link.setAttribute("aria-label",e),L.DomEvent.on(this.link,"click",L.DomEvent.stopPropagation).on(this.link,"click",L.DomEvent.preventDefault).on(this.link,"click",r,o),L.DomEvent.on(l,i.fullScreenEventName,L.DomEvent.stopPropagation).on(l,i.fullScreenEventName,L.DomEvent.preventDefault).on(l,i.fullScreenEventName,this._handleFullscreenChange,o),L.DomEvent.on(document,i.fullScreenEventName,L.DomEvent.stopPropagation).on(document,i.fullScreenEventName,L.DomEvent.preventDefault).on(document,i.fullScreenEventName,this._handleFullscreenChange,o),this.link},toggleFullScreen:function(){var e=this._map;e._exitFired=!1,e._isFullscreen?(i.supportsFullScreen&&!this.options.forcePseudoFullscreen?i.cancelFullScreen():L.DomUtil.removeClass(this.options.fullscreenElement||e._container,"leaflet-pseudo-fullscreen"),e.fire("exitFullscreen"),e._exitFired=!0,e._isFullscreen=!1):(i.supportsFullScreen&&!this.options.forcePseudoFullscreen?i.requestFullScreen(this.options.fullscreenElement||e._container):L.DomUtil.addClass(this.options.fullscreenElement||e._container,"leaflet-pseudo-fullscreen"),e.fire("enterFullscreen"),e._isFullscreen=!0)},_toggleTitle:function(){this.link.title=this._map._isFullscreen?this.options.title:this.options.titleCancel},_handleFullscreenChange:function(){var e=this._map;e.invalidateSize(),i.isFullScreen()||e._exitFired||(e.fire("exitFullscreen"),e._exitFired=!0,e._isFullscreen=!1)}}),L.Map.include({toggleFullscreen:function(){this.fullscreenControl.toggleFullScreen()}}),L.Map.addInitHook(function(){this.options.fullscreenControl&&this.addControl(L.control.fullscreen(this.options.fullscreenControlOptions))});var i={supportsFullScreen:!(L.control.fullscreen=function(e){return new L.Control.FullScreen(e)}),isFullScreen:function(){return!1},requestFullScreen:function(){},cancelFullScreen:function(){},fullScreenEventName:"",prefix:""},e="webkit moz o ms khtml".split(" ");if(void 0!==document.exitFullscreen)i.supportsFullScreen=!0;else{for(var n=0,t=e.length;n<t;n++)if(i.prefix=e[n],void 0!==document[i.prefix+"CancelFullScreen"]){i.supportsFullScreen=!0;break}void 0!==document.msExitFullscreen&&(i.prefix="ms",i.supportsFullScreen=!0)}i.supportsFullScreen&&("ms"===i.prefix?i.fullScreenEventName="MSFullscreenChange":i.fullScreenEventName=i.prefix+"fullscreenchange",i.isFullScreen=function(){switch(this.prefix){case"":return document.fullscreen;case"webkit":return document.webkitIsFullScreen;case"ms":return document.msFullscreenElement;default:return document[this.prefix+"FullScreen"]}},i.requestFullScreen=function(e){switch(this.prefix){case"":return e.requestFullscreen();case"ms":return e.msRequestFullscreen();default:return e[this.prefix+"RequestFullScreen"]()}},i.cancelFullScreen=function(){switch(this.prefix){case"":return document.exitFullscreen();case"ms":return document.msExitFullscreen();default:return document[this.prefix+"CancelFullScreen"]()}}),"undefined"!=typeof jQuery&&(jQuery.fn.requestFullScreen=function(){return this.each(function(){var e=jQuery(this);i.supportsFullScreen&&i.requestFullScreen(e)})}),window.fullScreenApi=i}();

View File

@@ -37,6 +37,8 @@ If your map have a zoomControl the fullscreen button will be added at the bottom
If your map doesn't have a zoomContron the fullscreen button will be added to topleft corner of the map (same as the zoomcontrol).
If you want to use the plugin on a map embedded in an iframe, don't forget to set `allowfullscreen` attribute on your iframe.
__Events and options__:
``` js
@@ -44,8 +46,8 @@ __Events and options__:
L.control.fullscreen({
position: 'topleft', // change the position of the button can be topleft, topright, bottomright or bottomleft, defaut topleft
title: 'Show me the fullscreen !', // change the title of the button, default Full Screen
titleCancel: 'Exit fullscreen mode' // change the title of the button when fullscreen is on, default Exit Full Screen
content: null // change the content of the button, can be HTML, default null
titleCancel: 'Exit fullscreen mode', // change the title of the button when fullscreen is on, default Exit Full Screen
content: null, // change the content of the button, can be HTML, default null
forceSeparateButton: true, // force seperate button to detach from zoom buttons, default false
forcePseudoFullscreen: true, // force use of pseudo full screen even if full screen API is available, default false
fullscreenElement: false // Dom element to render in full screen, false by default, fallback to map._container
@@ -59,6 +61,9 @@ map.on('enterFullscreen', function(){
map.on('exitFullscreen', function(){
console.log('exited fullscreen');
});
// you can also toggle fullscreen from map object
map.toggleFullScreen();
```
Where ?

View File

@@ -1,33 +0,0 @@
{
"name": "leaflet.fullscreen",
"version": "1.4.2",
"homepage": "https://github.com/brunob/leaflet.fullscreen",
"license": "MIT",
"authors": [
"brunob <brunobergot@gmail.com>"
],
"description": "Leaflet.Control.FullScreen for Leaflet",
"main": [
"Control.FullScreen.js",
"Control.FullScreen.css",
"icon-fullscreen.png",
"icon-fullscreen-2x.png"
],
"devDependencies": {
"eslint": "2.3.0"
},
"keywords": [
"leaflet",
"plugins",
"maps",
"fullscreen"
],
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests",
"index.html"
]
}

View File

@@ -3,18 +3,19 @@
<head>
<meta charset='utf-8'>
<title>Leaflet.Control.FullScreen Demo</title>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.css" />
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.5.1/dist/leaflet.css" />
<style type="text/css">
#map { width: 700px; height: 433px; }
.fullscreen-icon { background-image: url(icon-fullscreen.png); }
.leaflet-retina .fullscreen-icon { background-image: url(icon-fullscreen-2x.png); background-size: 26px 26px; }
/* one selector per rule as explained here : http://www.sitepoint.com/html5-full-screen-api/ */
#map:-webkit-full-screen { width: 100% !important; height: 100% !important; z-index: 99999; }
#map:-ms-fullscreen { width: 100% !important; height: 100% !important; z-index: 99999; }
#map:full-screen { width: 100% !important; height: 100% !important; z-index: 99999; }
#map:fullscreen { width: 100% !important; height: 100% !important; z-index: 99999; }
.leaflet-container:-webkit-full-screen { width: 100% !important; height: 100% !important; z-index: 99999; }
.leaflet-container:-ms-fullscreen { width: 100% !important; height: 100% !important; z-index: 99999; }
.leaflet-container:full-screen { width: 100% !important; height: 100% !important; z-index: 99999; }
.leaflet-container:fullscreen { width: 100% !important; height: 100% !important; z-index: 99999; }
.leaflet-pseudo-fullscreen { position: fixed !important; width: 100% !important; height: 100% !important; top: 0px !important; left: 0px !important; z-index: 99999; }
</style>
<script src="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.js"></script>
<script src="https://unpkg.com/leaflet@1.5.1/dist/leaflet.js"></script>
<script src="Control.FullScreen.js"></script>
</head>
<body>
@@ -22,13 +23,13 @@
<div id="map"></div>
<script>
var base = new L.TileLayer('http://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png', {
var base = L.tileLayer('https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png', {
maxZoom: 19,
subdomains: 'abcd',
attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> &copy; <a href="http://cartodb.com/attributions">CartoDB</a>'
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors &copy; <a href="https://carto.com/attributions">CARTO</a>',
});
var map = new L.Map('map', {
var map = L.map('map', {
layers: [base],
center: new L.LatLng(48.5, -4.5),
zoom: 5,

View File

@@ -1,10 +1,10 @@
{
"name": "leaflet.fullscreen",
"version": "1.4.2",
"version": "1.6.0",
"description": "Simple plugin for Leaflet that adds fullscreen button to your maps.",
"main": "Control.FullScreen.js",
"scripts": {
"test": "jshint Control.FullScreen.js"
"test": "eslint --config .eslintrc Control.FullScreen.js"
},
"repository": {
"type": "git",
@@ -17,7 +17,7 @@
"fullscreen"
],
"devDependencies": {
"eslint": "2.3.0"
"eslint": "^5.4.0"
},
"author": "b_b",
"license": "MIT License",

View File

@@ -18,3 +18,4 @@ Your pull requests are very welcome! Please follow these guidelines:
* [kcwu](https://github.com/kcwu)
* [Robbie Trencheny](https://github.com/robbiet480)
* [David Molineus](https://github.com/dmolineus)
* [Marwen Arfa](https://github.com/arfa)

View File

@@ -5,14 +5,16 @@
}
.leaflet-control-loading,
.leaflet-control-zoom a.leaflet-control-loading ,
.leaflet-control-zoomslider a.leaflet-control-loading {
.leaflet-control-zoom a.leaflet-control-loading,
.leaflet-control-zoomslider a.leaflet-control-loading,
.leaflet-control-layer-container {
display: none;
}
.leaflet-control-loading.is-loading,
.leaflet-control-zoom a.leaflet-control-loading.is-loading,
.leaflet-control-zoomslider a.leaflet-control-loading.is-loading {
.leaflet-control-zoomslider a.leaflet-control-loading.is-loading,
.leaflet-control-layer-container.is-loading {
display: block;
}

View File

@@ -71,8 +71,9 @@
}
else {
// Otherwise, create a container for the indicator
container = L.DomUtil.create('div', 'leaflet-control-zoom leaflet-bar');
container = L.DomUtil.create('div', 'leaflet-control-zoom leaflet-control-layer-container leaflet-bar');
}
this._indicatorContainer = container;
this._indicator = L.DomUtil.create('a', classes, container);
if (this.options.spinjs) {
this._spinner = new Spinner(this.options.spin).spin();
@@ -156,6 +157,7 @@
_showIndicator: function() {
// Show loading indicator
L.DomUtil.addClass(this._indicator, 'is-loading');
L.DomUtil.addClass(this._indicatorContainer, 'is-loading');
// If zoomControl exists, make the zoom-out button not last
if (!this.options.separate) {
@@ -171,6 +173,7 @@
_hideIndicator: function() {
// Hide loading indicator
L.DomUtil.removeClass(this._indicator, 'is-loading');
L.DomUtil.removeClass(this._indicatorContainer, 'is-loading');
// If zoomControl exists, make the zoom-out button last
if (!this.options.separate) {

View File

@@ -1 +1 @@
.leaflet-control-loading:empty{background-image:url('data:image/gif;base64,R0lGODlhEAAQAPQAAP///wAAAPDw8IqKiuDg4EZGRnp6egAAAFhYWCQkJKysrL6+vhQUFJycnAQEBDY2NmhoaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH+GkNyZWF0ZWQgd2l0aCBhamF4bG9hZC5pbmZvACH5BAAKAAAAIf8LTkVUU0NBUEUyLjADAQAAACwAAAAAEAAQAAAFdyAgAgIJIeWoAkRCCMdBkKtIHIngyMKsErPBYbADpkSCwhDmQCBethRB6Vj4kFCkQPG4IlWDgrNRIwnO4UKBXDufzQvDMaoSDBgFb886MiQadgNABAokfCwzBA8LCg0Egl8jAggGAA1kBIA1BAYzlyILczULC2UhACH5BAAKAAEALAAAAAAQABAAAAV2ICACAmlAZTmOREEIyUEQjLKKxPHADhEvqxlgcGgkGI1DYSVAIAWM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yAoxCq+KPxCNVsSMRgBsiClWrLTSWFoIQZHl6pleBh6suxKMIhlvzbAwkBWfFWrBQTxNLq2RG2yhSUkDs2b63AYDAoJXAcFRwADeAkJDX0AQCsEfAQMDAIPBz0rCgcxky0JRWE1AmwpKyEAIfkEAAoACAAsAAAAABAAEAAABXkgIAICKZzkqJ4nQZxLqZKv4NqNLKK2/Q4Ek4lFXChsg5ypJjs1II3gEDUSRInEGYAw6B6zM4JhrDAtEosVkLUtHA7RHaHAGJQEjsODcEg0FBAFVgkQJQ1pAwcDDw8KcFtSInwJAowCCA6RIwqZAgkPNgVpWndjdyohACH5BAAKAAkALAAAAAAQABAAAAV5ICACAimc5KieLEuUKvm2xAKLqDCfC2GaO9eL0LABWTiBYmA06W6kHgvCqEJiAIJiu3gcvgUsscHUERm+kaCxyxa+zRPk0SgJEgfIvbAdIAQLCAYlCj4DBw0IBQsMCjIqBAcPAooCBg9pKgsJLwUFOhCZKyQDA3YqIQAh+QQACgAKACwAAAAAEAAQAAAFdSAgAgIpnOSonmxbqiThCrJKEHFbo8JxDDOZYFFb+A41E4H4OhkOipXwBElYITDAckFEOBgMQ3arkMkUBdxIUGZpEb7kaQBRlASPg0FQQHAbEEMGDSVEAA1QBhAED1E0NgwFAooCDWljaQIQCE5qMHcNhCkjIQAh+QQACgALACwAAAAAEAAQAAAFeSAgAgIpnOSoLgxxvqgKLEcCC65KEAByKK8cSpA4DAiHQ/DkKhGKh4ZCtCyZGo6F6iYYPAqFgYy02xkSaLEMV34tELyRYNEsCQyHlvWkGCzsPgMCEAY7Cg04Uk48LAsDhRA8MVQPEF0GAgqYYwSRlycNcWskCkApIyEAOwAAAAAAAAAAAA==');background-repeat:no-repeat}.leaflet-control-loading,.leaflet-control-zoom a.leaflet-control-loading,.leaflet-control-zoomslider a.leaflet-control-loading{display:none}.leaflet-control-loading.is-loading,.leaflet-control-zoom a.leaflet-control-loading.is-loading,.leaflet-control-zoomslider a.leaflet-control-loading.is-loading{display:block}.leaflet-bar-part-bottom{border-bottom:medium none;border-bottom-left-radius:4px;border-bottom-right-radius:4px}
.leaflet-control-loading:empty{background-image:url('data:image/gif;base64,R0lGODlhEAAQAPQAAP///wAAAPDw8IqKiuDg4EZGRnp6egAAAFhYWCQkJKysrL6+vhQUFJycnAQEBDY2NmhoaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH+GkNyZWF0ZWQgd2l0aCBhamF4bG9hZC5pbmZvACH5BAAKAAAAIf8LTkVUU0NBUEUyLjADAQAAACwAAAAAEAAQAAAFdyAgAgIJIeWoAkRCCMdBkKtIHIngyMKsErPBYbADpkSCwhDmQCBethRB6Vj4kFCkQPG4IlWDgrNRIwnO4UKBXDufzQvDMaoSDBgFb886MiQadgNABAokfCwzBA8LCg0Egl8jAggGAA1kBIA1BAYzlyILczULC2UhACH5BAAKAAEALAAAAAAQABAAAAV2ICACAmlAZTmOREEIyUEQjLKKxPHADhEvqxlgcGgkGI1DYSVAIAWMx+lwSKkICJ0QsHi9RgKBwnVTiRQQgwF4I4UFDQQEwi6/3YSGWRRmjhEETAJfIgMFCnAKM0KDV4EEEAQLiF18TAYNXDaSe3x6mjidN1s3IQAh+QQACgACACwAAAAAEAAQAAAFeCAgAgLZDGU5jgRECEUiCI+yioSDwDJyLKsXoHFQxBSHAoAAFBhqtMJg8DgQBgfrEsJAEAg4YhZIEiwgKtHiMBgtpg3wbUZXGO7kOb1MUKRFMysCChAoggJCIg0GC2aNe4gqQldfL4l/Ag1AXySJgn5LcoE3QXI3IQAh+QQACgADACwAAAAAEAAQAAAFdiAgAgLZNGU5joQhCEjxIssqEo8bC9BRjy9Ag7GILQ4QEoE0gBAEBcOpcBA0DoxSK/e8LRIHn+i1cK0IyKdg0VAoljYIg+GgnRrwVS/8IAkICyosBIQpBAMoKy9dImxPhS+GKkFrkX+TigtLlIyKXUF+NjagNiEAIfkEAAoABAAsAAAAABAAEAAABWwgIAICaRhlOY4EIgjH8R7L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AKACwAAAAAEAAQAAAFdSAgAgIpnOSonmxbqiThCrJKEHFbo8JxDDOZYFFb+A41E4H4OhkOipXwBElYITDAckFEOBgMQ3arkMkUBdxIUGZpEb7kaQBRlASPg0FQQHAbEEMGDSVEAA1QBhAED1E0NgwFAooCDWljaQIQCE5qMHcNhCkjIQAh+QQACgALACwAAAAAEAAQAAAFeSAgAgIpnOSoLgxxvqgKLEcCC65KEAByKK8cSpA4DAiHQ/DkKhGKh4ZCtCyZGo6F6iYYPAqFgYy02xkSaLEMV34tELyRYNEsCQyHlvWkGCzsPgMCEAY7Cg04Uk48LAsDhRA8MVQPEF0GAgqYYwSRlycNcWskCkApIyEAOwAAAAAAAAAAAA==');background-repeat:no-repeat}.leaflet-control-layer-container,.leaflet-control-loading,.leaflet-control-zoom a.leaflet-control-loading,.leaflet-control-zoomslider a.leaflet-control-loading{display:none}.leaflet-control-layer-container.is-loading,.leaflet-control-loading.is-loading,.leaflet-control-zoom a.leaflet-control-loading.is-loading,.leaflet-control-zoomslider a.leaflet-control-loading.is-loading{display:block}.leaflet-bar-part-bottom{border-bottom:medium none;border-bottom-left-radius:4px;border-bottom-right-radius:4px}

File diff suppressed because one or more lines are too long

View File

@@ -4,19 +4,22 @@ Leaflet.loading
Leaflet.loading is a simple loading control for [Leaflet][]. An unobtrusive
loading indicator is added below the zoom control if one exists. The indicator
is visible when tiles are loading or when other data is loading, as indicated by
firing custom events on a map. The indicator can be an image, or a [spin.js][]
firing custom events on a map. The indicator can be an image, or a [spin.js][]
spinner (image-less).
## Usage
Leaflet.loading is only tested on Leaflet version 0.6 or greater. It will almost
certainly not work with older versions of Leaflet.
certainly not work with older versions of Leaflet. Of course we intend to
support Leaflet 1.0, and we have tested against the latest release (beta 2).
Please create an issue if you find that any part of this project is not
compatible with Leaflet 1.0.
Include `Control.Loading.js` and `Control.Loading.css`, then create a map with
`loadingControl: true` in its options.
Include `Control.Loading.js` and `Control.Loading.css`, then create a map with
`loadingControl: true` in its options.
By default, Leaflet.loading includes a base64-encoded animagted loading image in
By default, Leaflet.loading includes a base64-encoded animagted loading image in
`Control.Loading.css`. You can customize this by changing `background-image` for
the selector `.leaflet-control-loading`. The simplest case would be adding a 16
x 16 loading gif in `.leaflet-control-loading`.
@@ -28,13 +31,14 @@ initializing the control.
Whichever method you use, make sure you only use one.
Once the above is complete you will have a loading indicator that only appears
when tiles are loading.
when tiles are loading.
If you want to show the loading indicator while other AJAX requests or something
else is occurring, simply fire the `dataloading` event on your map when you
begin loading and `dataload` when you are finished loading. The control tracks
the number of concurrent loaders, so it is your responsibility to ensure that
the `dataloading` and `dataload` are called symmetrically.
else is occurring, fire the `dataloading` event on your map when you begin
loading and `dataload` when you are finished loading. Please note that there is
[an issue](https://github.com/ebrelsford/Leaflet.loading/issues/26) with the
way this control tracks these events and that this will be re-worked in a
future version.
### Options
@@ -43,20 +47,22 @@ the `dataloading` and `dataload` are called symmetrically.
- **separate**: (boolean) Whether the control should be separate from the zoom
control or not, defaults to false.
- **zoomControl**: (L.Control.Zoom) The zoom control that the control should be
added to. This is only necessary when adding a loading control to a zoom
added to. This is only necessary when adding a loading control to a zoom
control that you added manually and do not want a separate loading control.
- **spinjs**: (boolean) Enable the use of [spin.js][]. Optional, defaults to
- **delayIndicator**: (float) The number of milliseconds to wait before
showing the loading indicator. Defaults to `null` (no delay).
- **spinjs**: (boolean) Enable the use of [spin.js][]. Optional, defaults to
`false`
- **spin**: (object) A [spin.js][] options object. Optional, defaults to
- **spin**: (object) A [spin.js][] options object. Optional, defaults to
```
{
{
lines: 7,
length: 3,
width: 3,
radius: 5,
rotate: 13,
top: "83%"
top: "83%"
}
```

View File

@@ -1,12 +1,15 @@
{
"name": "leaflet.loading",
"version": "0.1.16",
"version": "0.1.24",
"homepage": "https://github.com/ebrelsford/leaflet.loading",
"authors": [
"Eric Brelsford <ebrelsford@gmail.com>"
],
"description": "A loading-indicator control for Leaflet",
"main": "src/Control.Loading.js",
"main": [
"src/Control.Loading.css",
"src/Control.Loading.js"
],
"keywords": [
"leaflet",
"map",

View File

@@ -1,6 +1,6 @@
{
"name": "leaflet-loading",
"version": "0.1.16",
"version": "0.1.24",
"description": "A simple loading control for Leaflet",
"main": "src/Control.Loading.js",
"scripts": {

View File

@@ -3,9 +3,152 @@ Leaflet.markercluster
(all changes without author notice are by [@danzel](https://github.com/danzel))
## Master
## 1.4.0 (2018-08-22)
##0.4 (2013-12-19)
Required leaflet version bumped to 1.3.1
### Improvements
* Tests run against leaflet 1.1.0+ [#863](https://github.com/Leaflet/Leaflet.markercluster/issues/863)
### Bugfixes
* Fix clearLayers not removing removed markers [#860](https://github.com/Leaflet/Leaflet.markercluster/issues/860)
* Remember opacity 0 correctly (by [@r-yanyo](https://github.com/r-yanyo)) [#890](https://github.com/Leaflet/Leaflet.markercluster/pull/890)
* Fix chunkedLoading LatLngBounds.intersects() (by [@boldtrn](https://github.com/boldtrn)) [#743](https://github.com/Leaflet/Leaflet.markercluster/issues/743) [#891](https://github.com/Leaflet/Leaflet.markercluster/pull/891)
## 1.3.0 (2018-01-19)
### Improvements
* Use Rollup for builds (by [@IvanSanchez](https://github.com/IvanSanchez)) [#769](https://github.com/Leaflet/Leaflet.markercluster/pull/769)
### Bugfixes
* Fix Spiderfier positioning for small markers (by [@ghybs](https://github.com/ghybs)) [#846](https://github.com/Leaflet/Leaflet.markercluster/pull/846)
* Fix anchor usage with latest leaflet version [#861](https://github.com/Leaflet/Leaflet.markercluster/issues/861)
## 1.2.0 (2017-11-06)
### Improvements
* Move `clusterPane` option in to `options` field (by [@ghybs](https://github.com/ghybs)) [#832](https://github.com/Leaflet/Leaflet.markercluster/pull/832)
### Bugfixes
* Fix very small `maxClusterRadius` hanging the browser (by [@lucaswerkmeister](https://github.com/lucaswerkmeister)) [#838](https://github.com/Leaflet/Leaflet.markercluster/pull/838)
## 1.1.0 (2017-08-27)
### Improvements
* Add `clusterPane` option to allow putting clusters in a different pane (by [@ckrahe](https://github.com/ckrahe)) [#819](https://github.com/Leaflet/Leaflet.markercluster/issues/819)
## 1.0.6 (2017-06-19)
### Bugfixes
* Fix some issues when used with non-integer zoom [#789](https://github.com/Leaflet/Leaflet.markercluster/issues/789)
* Change examples to use https (by [@ghybs](https://github.com/ghybs)) [#794](https://github.com/Leaflet/Leaflet.markercluster/pull/794)
## 1.0.5 (2017-04-26)
### Improvements
* Allow passing fitBounds options to zoomToBounds (by [@timkelty](https://github.com/timkelty)) [#779](https://github.com/Leaflet/Leaflet.markercluster/pull/779)
### Bugfixes
* Fixed bug where disableClusteringAtZoom being 0 is treated the same as null (by [@MrCheeze](https://github.com/MrCheeze)) [#773](https://github.com/Leaflet/Leaflet.markercluster/pull/773)
## 1.0.4 (2017-03-14)
### Bugfixes
* Fix errors removing a MarkerClusterGroup from the map during an animation [#758](https://github.com/Leaflet/Leaflet.markercluster/issues/758)
## 1.0.3 (2017-02-02)
### Bugfixes
* Fix moving markers while the MarkerClusterGroup is not on the map [#753](https://github.com/Leaflet/Leaflet.markercluster/issues/753)
## 1.0.2 (2017-01-27)
### Improvements
* Support `layeradd` and `layerremove` events [#647](https://github.com/Leaflet/Leaflet.markercluster/issues/647)
### Bugfixes
* Add support for maps with negative minZoom [#704](https://github.com/Leaflet/Leaflet.markercluster/issues/704)
* Fixed zoomToShowLayer() markers disappearing bug (by [@z3ut](https://github.com/z3ut)) [#739](https://github.com/Leaflet/Leaflet.markercluster/issues/739)
* Fix an issue when opening a popup inside of zoomToShowLayer
* If a marker is moved with an open popup on it, re-open the popup after moving it. [#651](https://github.com/Leaflet/Leaflet.markercluster/issues/651)
## 1.0.1 (2017-01-25)
### Improvements
* Add install and build steps with jake (by [@kazes](https://github.com/kazes)) [#733](https://github.com/Leaflet/Leaflet.markercluster/pull/733)
* Readme improvements (by [@ghybs](https://github.com/ghybs), [@bertyhell](https://github.com/bertyhell)) [#734](https://github.com/Leaflet/Leaflet.markercluster/pull/738), [#734](https://github.com/Leaflet/Leaflet.markercluster/pull/738
* Bump all examples to leaflet 1.0.3
### Bugfixes
* Fixed leaflet 1.0.2 bug where clearLayers would throw an exception (by [@marcianoviereck92](https://github.com/marcianoviereck92)) [#746](https://github.com/Leaflet/Leaflet.markercluster/pull/746)
## 1.0.0 (2016-10-03)
### Improvements
* Compatibility with Leaflet 1.0.0 (by [@danzel](https://githum.com/danzel), [@Eschon](https://github.com/Eschon), [@ghybs](https://github.com/ghybs), [@IvanSanchez](https://github.com/IvanSanchez))
* Support moving markers [#57](https://github.com/Leaflet/Leaflet.markercluster/issues/57)
* chunkedLoading option to keep browser more responsive during larging a load data set [#292](https://github.com/Leaflet/Leaflet.markercluster/issues/292)
* maxClusterRadius can be a function (by [@Schwanksta](https://github.com/Schwanksta)) [#298](https://github.com/Leaflet/Leaflet.markercluster/issues/298)
* Spiderfy without zooming when all markers at same location (by [@rdenniston](https://github.com/rdenniston), [@ghybs](https://github.com/ghybs)) [#415](https://github.com/Leaflet/Leaflet.markercluster/issues/415), [#606](https://github.com/Leaflet/Leaflet.markercluster/issues/606)
* On becoming visible, markers retain their original opacity. (by [@IvanSanchez](https://github.com/IvanSanchez)) [#444](https://github.com/Leaflet/Leaflet.markercluster/issues/444)
* Spiderleg Polyline options (by [@mikeatlas](https://github.com/mikeatlas)) [#466](https://github.com/Leaflet/Leaflet.markercluster/issues/466)
* Extra methods to allow refreshing cluster icons (by [@ghybs](https://github.com/ghybs)) [#564](https://github.com/Leaflet/Leaflet.markercluster/issues/564)
* Ability to disable animations (by [@ghybs](https://github.com/ghybs)) [#578](https://github.com/Leaflet/Leaflet.markercluster/issues/578)
* Optimized performance of bulk addLayers and removeLayers (by [@ghybs](https://github.com/ghybs)) [#584](https://github.com/Leaflet/Leaflet.markercluster/issues/584)
* Replaced spiderfy legs animation from SMIL to CSS transition (by [@ghybs](https://github.com/ghybs)) [#585](https://github.com/Leaflet/Leaflet.markercluster/issues/585)
* Provide more detailed context information on the spiderfied event (by [@evanvosberg](https://github.com/evanvosberg)) [#421](https://github.com/Leaflet/Leaflet.markercluster/issues/421)
* Add unspiderfied event
* Readme updates (by [@ghybs](https://github.com/ghybs), [@tomchadwin](https://github.com/tomchadwin) [@Cyrille37](https://github.com/Cyrille37) [@franckl](https://github.com/franckl) [@mikeatlas](https://github.com/mikeatlas)
[@rdenniston](https://github.com/rdenniston) [@maackle](https://github.com/maackle) [@fureigh](https://github.com/fureigh) [@Wildhoney](https://github.com/Wildhoney) [@Schwanksta](https://github.com/Schwanksta) [@frankrowe](https://github.com/frankrowe))
* Improve adding and removing nested LayerGroups (by [@ghybs](https://github.com/ghybs)) [#624](https://github.com/Leaflet/Leaflet.markercluster/pull/624)
* Add public unspiderfy method (by [@zverev](https://github.com/zverev)) [#617](https://github.com/Leaflet/Leaflet.markercluster/pull/617)
* Optimized performance of bulk add with complex icon create function (by [@mlazowik](https://github.com/mlazowik)) [#697](https://github.com/Leaflet/Leaflet.markercluster/pull/697)
* Remove leaflet from peerDependencies (by [@tyleralves](https://github.com/tyleralves)) [#703](https://github.com/Leaflet/Leaflet.markercluster/pull/703)
* Simplified _recursively (by [@ghybs](https://github.com/ghybs)) [#656](https://github.com/Leaflet/Leaflet.markercluster/pull/656)
### Bugfixes
* Fix getBounds when removeOutsideVisibleBounds: false is set. [#321](https://github.com/Leaflet/Leaflet.markercluster/issues/321)
* Fix zoomToShowLayer fails after initial spiderfy [#286](https://github.com/Leaflet/Leaflet.markercluster/issues/286)
* Fix cluster not disappearing on Android [#344](https://github.com/Leaflet/Leaflet.markercluster/issues/344)
* Fix RemoveLayers() when spiderified (by [@Grsmto](https://github.com/Grsmto)) [#358](https://github.com/Leaflet/Leaflet.markercluster/issues/358)
* Remove lines from map when removing cluster (by [@olive380](https://github.com/olive380)) [#532](https://github.com/Leaflet/Leaflet.markercluster/issues/532)
* Fix getConvexHull when all markers are located at same latitude (by [@olive380](https://github.com/olive380)) [#533](https://github.com/Leaflet/Leaflet.markercluster/issues/533)
* Fix removeLayers when cluster is not on the map (by [@eschon](https://github.com/eschon)) [#556](https://github.com/Leaflet/Leaflet.markercluster/issues/556)
* Improved zoomToShowLayer with callback check (by [@ghybs](https://github.com/ghybs)) [#572](https://github.com/Leaflet/Leaflet.markercluster/issues/572)
* Improved reliability of RefreshSpec test suite for PhantomJS (by [@ghybs](https://github.com/ghybs)) [#577](https://github.com/Leaflet/Leaflet.markercluster/issues/577)
* Corrected effect of removeOutsideVisibleBounds option (by [@ghybs](https://github.com/ghybs)) [#575](https://github.com/Leaflet/Leaflet.markercluster/issues/575)
* Fix getLayer when provided a string [#531](https://github.com/Leaflet/Leaflet.markercluster/issues/531)
* Documentation improvements (by [@ghybs](https://github.com/ghybs)) [#579](https://github.com/Leaflet/Leaflet.markercluster/issues/579)
* Correct _getExpandedVisibleBounds for Max Latitude (by [@ghybs](https://github.com/ghybs)) [#587](https://github.com/Leaflet/Leaflet.markercluster/issues/587)
* Correct unspiderfy vector (by [@ghybs](https://github.com/ghybs)) [#604](https://github.com/Leaflet/Leaflet.markercluster/issues/604)
* Remove "leaflet-cluster-anim" class on map remove while spiderfied (by [@ghybs](https://github.com/ghybs)) [#607](https://github.com/Leaflet/Leaflet.markercluster/issues/607)
* Fix disableClusteringAtZoom maxZoom troubles (by [@OriginalSin](https://github.com/OriginalSin)) [#609](https://github.com/Leaflet/Leaflet.markercluster/issues/609)
* Fix clusters not disappearing when they were near the edge on mobile (by [@ghybs](https://github.com/ghybs)) [#529](https://github.com/Leaflet/Leaflet.markercluster/issues/529)
* Remove leaflet from dependencies (by [@ghybs](https://github.com/ghybs)) [#639](https://github.com/Leaflet/Leaflet.markercluster/issues/639)
* Fix interaction between zoomOrSpiderfy and disableClusteringAtZoom (by [@ghybs](https://github.com/ghybs)) [#633](https://github.com/Leaflet/Leaflet.markercluster/issues/633) [#648](https://github.com/Leaflet/Leaflet.markercluster/issues/648)
## 0.4 (2013-12-19)
### Improvements
@@ -16,7 +159,8 @@ Leaflet.markercluster
* Fix some cases zoomToShowLayer wouldn't work (Reported by [@absemetov](https://github.com/absemetov)) [#203](https://github.com/Leaflet/Leaflet.markercluster/issues/203) [#228](https://github.com/Leaflet/Leaflet.markercluster/issues/228) [#286](https://github.com/Leaflet/Leaflet.markercluster/issues/286)
##0.3 (2013-12-18)
## 0.3 (2013-12-18)
### Improvements

View File

@@ -5,6 +5,8 @@ Provides Beautiful Animated Marker Clustering functionality for [Leaflet](http:/
*Requires Leaflet 1.0.0*
![cluster map example](example/map.png)
For a Leaflet 0.7 compatible version, [use the leaflet-0.7 branch](https://github.com/Leaflet/Leaflet.markercluster/tree/leaflet-0.7)<br>
For a Leaflet 0.5 compatible version, [Download b128e950](https://github.com/Leaflet/Leaflet.markercluster/archive/b128e950d8f5d7da5b60bd0aa9a88f6d3dd17c98.zip)<br>
For a Leaflet 0.4 compatible version, [Download the 0.2 release](https://github.com/Leaflet/Leaflet.markercluster/archive/0.2.zip)
@@ -16,6 +18,8 @@ removed link to h1 and indented back 2 spaces all links.
-->
## Table of Contents
* [Using the plugin](#using-the-plugin)
* [Building, testing and linting scripts](#building-testing-and-linting-scripts)
* [Examples](#examples)
* [Usage](#usage)
* [Options](#options)
* [Defaults](#defaults)
@@ -43,13 +47,26 @@ removed link to h1 and indented back 2 spaces all links.
## Using the plugin
Include the plugin CSS and JS files on your page after Leaflet files, using your method of choice:
* [Download the `v1.4.1` release](https://github.com/Leaflet/Leaflet.markercluster/archive/v1.4.1.zip)
* Use unpkg CDN: `https://unpkg.com/leaflet.markercluster@1.4.1/dist/`
* Install with npm: `npm install leaflet.markercluster`
Install with npm: `npm install leaflet.markercluster`
In each case, use files in the `dist` folder:
* `MarkerCluster.css`
* `MarkerCluster.Default.css` (not needed if you use your own `iconCreateFunction` instead of the default one)
* `leaflet.markercluster.js` (or `leaflet.markercluster-src.js` for the non-minified version)
### Building, testing and linting scripts
Install jake `npm install -g jake` then run `npm install`
* To check the code for errors and build Leaflet from source, run `jake`.
* To run the tests, run `jake test`.
### Examples
See the included examples for usage.
The [realworld example](http://leaflet.github.io/Leaflet.markercluster/example/marker-clustering-realworld.388.html) is a good place to start, it uses all of the defaults of the clusterer.
Or check out the [custom example](http://leaflet.github.io/Leaflet.markercluster/example/marker-clustering-custom.html) for how to customise the behaviour and appearance of the clusterer
The [realworld example](https://leaflet.github.io/Leaflet.markercluster/example/marker-clustering-realworld.388.html) is a good place to start, it uses all of the defaults of the clusterer.
Or check out the [custom example](https://leaflet.github.io/Leaflet.markercluster/example/marker-clustering-custom.html) for how to customise the behaviour and appearance of the clusterer
### Usage
Create a new MarkerClusterGroup, add your markers to it, then add it to the map
@@ -92,7 +109,7 @@ var markers = L.markerClusterGroup({
}
});
```
Check out the [custom example](http://leaflet.github.io/Leaflet.markercluster/example/marker-clustering-custom.html) for an example of this.
Check out the [custom example](https://leaflet.github.io/Leaflet.markercluster/example/marker-clustering-custom.html) for an example of this.
If you need to update the clusters icon (e.g. they are based on markers real-time data), use the method [refreshClusters()](#refreshing-the-clusters-icon).
@@ -106,13 +123,14 @@ If you need to update the clusters icon (e.g. they are based on markers real-tim
#### Other options
* **animateAddingMarkers**: If set to true (and `animate` option is also true) then adding individual markers to the MarkerClusterGroup after it has been added to the map will add the marker and animate it into the cluster. Defaults to false as this gives better performance when bulk adding markers. addLayers does not support this, only addLayer with individual Markers.
* **disableClusteringAtZoom**: If set, at this zoom level and below, markers will not be clustered. This defaults to disabled. [See Example](http://leaflet.github.io/Leaflet.markercluster/example/marker-clustering-realworld-maxzoom.388.html). Note: you may be interested in disabling `spiderfyOnMaxZoom` option when using `disableClusteringAtZoom`.
* **disableClusteringAtZoom**: If set, at this zoom level and below, markers will not be clustered. This defaults to disabled. [See Example](https://leaflet.github.io/Leaflet.markercluster/example/marker-clustering-realworld-maxzoom.388.html). Note: you may be interested in disabling `spiderfyOnMaxZoom` option when using `disableClusteringAtZoom`.
* **maxClusterRadius**: The maximum radius that a cluster will cover from the central marker (in pixels). Default 80. Decreasing will make more, smaller clusters. You can also use a function that accepts the current map zoom and returns the maximum cluster radius in pixels.
* **polygonOptions**: Options to pass when creating the L.Polygon(points, options) to show the bounds of a cluster. Defaults to empty, which lets Leaflet use the [default Path options](http://leafletjs.com/reference.html#path-options).
* **singleMarkerMode**: If set to true, overrides the icon for all added markers to make them appear as a 1 size cluster. Note: the markers are not replaced by cluster objects, only their icon is replaced. Hence they still react to normal events, and option `disableClusteringAtZoom` does not restore their previous icon (see [#391](https://github.com/Leaflet/Leaflet.markercluster/issues/391)).
* **spiderLegPolylineOptions**: Allows you to specify [PolylineOptions](http://leafletjs.com/reference.html#polyline-options) to style spider legs. By default, they are `{ weight: 1.5, color: '#222', opacity: 0.5 }`.
* **spiderfyDistanceMultiplier**: Increase from 1 to increase the distance away from the center that spiderfied markers are placed. Use if you are using big marker icons (Default: 1).
* **iconCreateFunction**: Function used to create the cluster icon [See default as example](https://github.com/Leaflet/Leaflet.markercluster/blob/15ed12654acdc54a4521789c498e4603fe4bf781/src/MarkerClusterGroup.js#L542).
* **iconCreateFunction**: Function used to create the cluster icon. See [the default implementation](https://github.com/Leaflet/Leaflet.markercluster/blob/15ed12654acdc54a4521789c498e4603fe4bf781/src/MarkerClusterGroup.js#L542) or the [custom example](https://leaflet.github.io/Leaflet.markercluster/example/marker-clustering-custom.html).
* **clusterPane**: Map pane where the cluster icons will be added. Defaults to L.Marker's default (currently 'markerPane'). [See the pane example](https://leaflet.github.io/Leaflet.markercluster/example/marker-clustering-pane.html).
#### Chunked addLayers options
Options for the [addLayers](#bulk-adding-and-removing-markers) method. See [#357](https://github.com/Leaflet/Leaflet.markercluster/issues/357) for explanation on how the chunking works.
@@ -217,7 +235,7 @@ markers.on('clusterclick', function (a) {
```
You can also query for the bounding convex polygon.
See [example/marker-clustering-convexhull.html](http://leaflet.github.io/Leaflet.markercluster/example/marker-clustering-convexhull.html) for a working example.
See [example/marker-clustering-convexhull.html](https://leaflet.github.io/Leaflet.markercluster/example/marker-clustering-convexhull.html) for a working example.
```javascript
markers.on('clusterclick', function (a) {
map.addLayer(L.polygon(a.layer.getConvexHull()));
@@ -227,23 +245,25 @@ markers.on('clusterclick', function (a) {
#### Zooming to the bounds of a cluster
When you receive an event from a cluster you can zoom to its bounds in one easy step.
If all of the markers will appear at a higher zoom level, that zoom level is zoomed to instead.
See [marker-clustering-zoomtobounds.html](http://leaflet.github.io/Leaflet.markercluster/example/marker-clustering-zoomtobounds.html) for a working example.
`zoomToBounds` takes an optional argument to pass [options to the resulting `fitBounds` call](http://leafletjs.com/reference.html#map-fitboundsoptions).
See [marker-clustering-zoomtobounds.html](https://leaflet.github.io/Leaflet.markercluster/example/marker-clustering-zoomtobounds.html) for a working example.
```javascript
markers.on('clusterclick', function (a) {
a.layer.zoomToBounds();
a.layer.zoomToBounds({padding: [20, 20]});
});
```
#### Other clusters methods
* **getChildCount**: Returns the total number of markers contained within that cluster.
* **getAllChildMarkers**: Returns the array of total markers contained within that cluster.
* **getAllChildMarkers(storage: array | undefined, ignoreDraggedMarker: boolean | undefined)**: Returns an array of all markers contained within this cluster (storage will be used if provided). If ignoreDraggedMarker is true and there is currently a marker dragged, the dragged marker will not be included in the array.
* **spiderfy**: Spiderfies the child markers of this cluster
* **unspiderfy**: Unspiderfies a cluster (opposite of spiderfy)
## Handling LOTS of markers
The Clusterer can handle 10,000 or even 50,000 markers (in chrome). IE9 has some issues with 50,000.
- [realworld 10,000 example](http://leaflet.github.io/Leaflet.markercluster/example/marker-clustering-realworld.10000.html)
- [realworld 50,000 example](http://leaflet.github.io/Leaflet.markercluster/example/marker-clustering-realworld.50000.html)
- [realworld 10,000 example](https://leaflet.github.io/Leaflet.markercluster/example/marker-clustering-realworld.10000.html)
- [realworld 50,000 example](https://leaflet.github.io/Leaflet.markercluster/example/marker-clustering-realworld.50000.html)
Note: these two examples use the `chunkedLoading` option set to true in order to avoid locking the browser for a long time.
@@ -268,3 +288,5 @@ Check also the below sub-plugins:
| [Leaflet.FeatureGroup.SubGroup](https://github.com/ghybs/Leaflet.FeatureGroup.SubGroup) | Creates a Feature Group that adds its child layers into a parent group when added to a map (e.g. through L.Control.Layers). Typical usage is to dynamically add/remove groups of markers from Marker Cluster. | [ghybs](https://github.com/ghybs) |
| [Leaflet.MarkerCluster.LayerSupport](https://github.com/ghybs/Leaflet.MarkerCluster.LayerSupport) | Brings compatibility with L.Control.Layers and other Leaflet plugins. I.e. everything that uses direct calls to map.addLayer and map.removeLayer. | [ghybs](https://github.com/ghybs) |
| [Leaflet.MarkerCluster.Freezable](https://github.com/ghybs/Leaflet.MarkerCluster.Freezable) | Adds the ability to freeze clusters at a specified zoom. E.g. freezing at maxZoom + 1 makes as if clustering was programmatically disabled. | [ghybs](https://github.com/ghybs) |
| [Leaflet.MarkerCluster.PlacementStrategies](https://github.com/adammertel/Leaflet.MarkerCluster.PlacementStrategies) | Implements new strategies to position clustered markers (eg: clock, concentric circles, ...). Recommended to use with circleMarkers. [Demo](https://adammertel.github.io/Leaflet.MarkerCluster.PlacementStrategies/demo/demo1.html) | [adammertel](https://github.com/adammertel) / [UNIVIE](http://carto.univie.ac.at/) |
| [Leaflet.MarkerCluster.List](https://github.com/adammertel/Leaflet.MarkerCluster.List) | Displays child elements in a list. Suitable for mobile devices. [Demo](https://adammertel.github.io/Leaflet.MarkerCluster.List/demo/demo1.html) | [adammertel](https://github.com/adammertel) / [UNIVIE](http://carto.univie.ac.at/) |

View File

@@ -1,6 +1,6 @@
{
"name": "leaflet.markercluster",
"version": "0.4.0-hotfix.1",
"version": "1.4.0",
"homepage": "https://github.com/Leaflet/Leaflet.markercluster",
"authors": [
"Dave Leaver <danzel@localhost.geek.nz>"
@@ -22,6 +22,6 @@
"tests"
],
"dependencies": {
"leaflet": ">= 0.7.0"
"leaflet": ">= 1.3.1"
}
}

View File

@@ -1,17 +1,25 @@
/*
Leaflet.markercluster, Provides Beautiful Animated Marker Clustering functionality for Leaflet, a JS library for interactive maps.
https://github.com/Leaflet/Leaflet.markercluster
(c) 2012-2013, Dave Leaver, smartrak
*/
(function (window, document, undefined) {/*
* Leaflet.markercluster 1.4.1+master.37ab9a2,
* Provides Beautiful Animated Marker Clustering functionality for Leaflet, a JS library for interactive maps.
* https://github.com/Leaflet/Leaflet.markercluster
* (c) 2012-2017, Dave Leaver, smartrak
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(factory((global.Leaflet = global.Leaflet || {}, global.Leaflet.markercluster = global.Leaflet.markercluster || {})));
}(this, (function (exports) { 'use strict';
/*
* L.MarkerClusterGroup extends L.FeatureGroup by clustering the markers contained within
*/
L.MarkerClusterGroup = L.FeatureGroup.extend({
var MarkerClusterGroup = L.MarkerClusterGroup = L.FeatureGroup.extend({
options: {
maxClusterRadius: 80, //A cluster will cover at most this many pixels from its center
iconCreateFunction: null,
clusterPane: L.Marker.prototype.options.pane,
spiderfyOnMaxZoom: true,
showCoverageOnHover: true,
@@ -69,6 +77,12 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
this._queue = [];
this._childMarkerEventHandlers = {
'dragstart': this._childMarkerDragStart,
'move': this._childMarkerMoved,
'dragend': this._childMarkerDragEnd,
};
// Hook the appropriate animation methods.
var animate = L.DomUtil.TRANSITION && this.options.animate;
L.extend(this, animate ? this._withAnimation : this._noAnimation);
@@ -85,11 +99,13 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
//Don't cluster non point data
if (!layer.getLatLng) {
this._nonPointGroup.addLayer(layer);
this.fire('layeradd', { layer: layer });
return this;
}
if (!this._map) {
this._needsClustering.push(layer);
this.fire('layeradd', { layer: layer });
return this;
}
@@ -105,6 +121,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
}
this._addLayer(layer, this._maxZoom);
this.fire('layeradd', { layer: layer });
// Refresh bounds and weighted positions.
this._topClusterLevel._recalculateBounds();
@@ -139,13 +156,15 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
//Non point layers
if (!layer.getLatLng) {
this._nonPointGroup.removeLayer(layer);
this.fire('layerremove', { layer: layer });
return this;
}
if (!this._map) {
if (!this._arraySplice(this._needsClustering, layer) && this.hasLayer(layer)) {
this._needsRemoving.push(layer);
this._needsRemoving.push({ layer: layer, latlng: layer._latlng });
}
this.fire('layerremove', { layer: layer });
return this;
}
@@ -160,13 +179,14 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
//Remove the marker from clusters
this._removeLayer(layer, true);
this.fire('layerremove', { layer: layer });
// Refresh bounds and weighted positions.
this._topClusterLevel._recalculateBounds();
this._refreshClustersIcons();
layer.off('move', this._childMarkerMoved, this);
layer.off(this._childMarkerEventHandlers, this);
if (this._featureGroup.hasLayer(layer)) {
this._featureGroup.removeLayer(layer);
@@ -179,7 +199,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
},
//Takes an array of markers and adds them in bulk
addLayers: function (layersArray) {
addLayers: function (layersArray, skipLayerAddEvent) {
if (!L.Util.isArray(layersArray)) {
return this.addLayer(layersArray);
}
@@ -228,6 +248,9 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
//Not point data, can't be clustered
if (!m.getLatLng) {
npg.addLayer(m);
if (!skipLayerAddEvent) {
this.fire('layeradd', { layer: m });
}
continue;
}
@@ -236,6 +259,9 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
}
this._addLayer(m, this._maxZoom);
if (!skipLayerAddEvent) {
this.fire('layeradd', { layer: m });
}
//If we just made a cluster of size 2 then we need to remove the other marker from the map (if it is) or we never will
if (m.__parent) {
@@ -326,8 +352,9 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
this._arraySplice(this._needsClustering, m);
npg.removeLayer(m);
if (this.hasLayer(m)) {
this._needsRemoving.push(m);
this._needsRemoving.push({ layer: m, latlng: m._latlng });
}
this.fire('layerremove', { layer: m });
}
return this;
}
@@ -368,10 +395,12 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
if (!m.__parent) {
npg.removeLayer(m);
this.fire('layerremove', { layer: m });
continue;
}
this._removeLayer(m, true, true);
this.fire('layerremove', { layer: m });
if (fg.hasLayer(m)) {
fg.removeLayer(m);
@@ -399,6 +428,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
//If we aren't on the map (yet), blow away the markers we know of
if (!this._map) {
this._needsClustering = [];
this._needsRemoving = [];
delete this._gridClusters;
delete this._gridUnclustered;
}
@@ -412,9 +442,9 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
this._nonPointGroup.clearLayers();
this.eachLayer(function (marker) {
marker.off('move', this._childMarkerMoved, this);
marker.off(this._childMarkerEventHandlers, this);
delete marker.__parent;
});
}, this);
if (this._map) {
//Reset _topClusterLevel and the DistanceGrids
@@ -445,14 +475,23 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
eachLayer: function (method, context) {
var markers = this._needsClustering.slice(),
needsRemoving = this._needsRemoving,
i;
thisNeedsRemoving, i, j;
if (this._topClusterLevel) {
this._topClusterLevel.getAllChildMarkers(markers);
}
for (i = markers.length - 1; i >= 0; i--) {
if (needsRemoving.indexOf(markers[i]) === -1) {
thisNeedsRemoving = true;
for (j = needsRemoving.length - 1; j >= 0; j--) {
if (needsRemoving[j].layer === markers[i]) {
thisNeedsRemoving = false;
break;
}
}
if (thisNeedsRemoving) {
method.call(context, markers[i]);
}
}
@@ -472,7 +511,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
//Overrides LayerGroup.getLayer, WARNING: Really bad performance
getLayer: function (id) {
var result = null;
id = parseInt(id, 10);
this.eachLayer(function (l) {
@@ -500,7 +539,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
anArray = this._needsRemoving;
for (i = anArray.length - 1; i >= 0; i--) {
if (anArray[i] === layer) {
if (anArray[i].layer === layer) {
return false;
}
}
@@ -510,7 +549,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
//Zoom down to show the given layer (spiderfying if necessary) then calls the callback
zoomToShowLayer: function (layer, callback) {
if (typeof callback !== 'function') {
callback = function () {};
}
@@ -537,20 +576,9 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
this._map.on('moveend', showMarker, this);
this._map.panTo(layer.getLatLng());
} else {
var moveStart = function () {
this._map.off('movestart', moveStart, this);
moveStart = null;
};
this._map.on('movestart', moveStart, this);
this._map.on('moveend', showMarker, this);
this.on('animationend', showMarker, this);
layer.__parent.zoomToBounds();
if (moveStart) {
//Never started moving, must already be there, probably need clustering however
showMarker.call(this);
}
}
},
@@ -572,9 +600,17 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
this._maxLat = map.options.crs.projection.MAX_LATITUDE;
//Restore all the positions as they are in the MCG before removing them
for (i = 0, l = this._needsRemoving.length; i < l; i++) {
layer = this._needsRemoving[i];
this._removeLayer(layer, true);
layer.newlatlng = layer.layer._latlng;
layer.layer._latlng = layer.latlng;
}
//Remove them, then restore their new positions
for (i = 0, l = this._needsRemoving.length; i < l; i++) {
layer = this._needsRemoving[i];
this._removeLayer(layer.layer, true);
layer.layer._latlng = layer.newlatlng;
}
this._needsRemoving = [];
@@ -594,7 +630,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
//Actually add our markers to the map:
l = this._needsClustering;
this._needsClustering = [];
this.addLayers(l);
this.addLayers(l, true);
},
//Overrides FeatureGroup.onRemove
@@ -648,33 +684,58 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
* @private
*/
_removeFromGridUnclustered: function (marker, z) {
var map = this._map,
gridUnclustered = this._gridUnclustered;
var map = this._map,
gridUnclustered = this._gridUnclustered,
minZoom = Math.floor(this._map.getMinZoom());
for (; z >= 0; z--) {
for (; z >= minZoom; z--) {
if (!gridUnclustered[z].removeObject(marker, map.project(marker.getLatLng(), z))) {
break;
}
}
},
_childMarkerMoved: function (e) {
if (!this._ignoreMove) {
e.target._latlng = e.oldLatLng;
this.removeLayer(e.target);
_childMarkerDragStart: function (e) {
e.target.__dragStart = e.target._latlng;
},
e.target._latlng = e.latlng;
this.addLayer(e.target);
_childMarkerMoved: function (e) {
if (!this._ignoreMove && !e.target.__dragStart) {
var isPopupOpen = e.target._popup && e.target._popup.isOpen();
this._moveChild(e.target, e.oldLatLng, e.latlng);
if (isPopupOpen) {
e.target.openPopup();
}
}
},
_moveChild: function (layer, from, to) {
layer._latlng = from;
this.removeLayer(layer);
layer._latlng = to;
this.addLayer(layer);
},
_childMarkerDragEnd: function (e) {
var dragStart = e.target.__dragStart;
delete e.target.__dragStart;
if (dragStart) {
this._moveChild(e.target, dragStart, e.target._latlng);
}
},
//Internal function for removing a marker from everything.
//dontUpdateMap: set to true if you will handle updating the map manually (for bulk functions)
_removeLayer: function (marker, removeFromDistanceGrid, dontUpdateMap) {
var gridClusters = this._gridClusters,
gridUnclustered = this._gridUnclustered,
fg = this._featureGroup,
map = this._map;
map = this._map,
minZoom = Math.floor(this._map.getMinZoom());
//Remove the marker from distance clusters it might be in
if (removeFromDistanceGrid) {
@@ -693,7 +754,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
cluster._childCount--;
cluster._boundsNeedUpdate = true;
if (cluster._zoom < 0) {
if (cluster._zoom < minZoom) {
//Top level, do nothing
break;
} else if (removeFromDistanceGrid && cluster._childCount <= 1) { //Cluster no longer required
@@ -867,7 +928,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
var newBounds = this._getExpandedVisibleBounds();
this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, this._zoom, newBounds);
this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, Math.floor(this._map.getMinZoom()), this._zoom, newBounds);
this._topClusterLevel._recursivelyAddChildrenToMap(null, Math.round(this._map._zoom), newBounds);
this._currentShownBounds = newBounds;
@@ -875,10 +936,11 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
},
_generateInitialClusters: function () {
var maxZoom = this._map.getMaxZoom(),
var maxZoom = Math.ceil(this._map.getMaxZoom()),
minZoom = Math.floor(this._map.getMinZoom()),
radius = this.options.maxClusterRadius,
radiusFn = radius;
//If we just set maxClusterRadius to a single number, we need to create
//a simple function to return that number. Otherwise, we just have to
//use the function we've passed in.
@@ -886,37 +948,38 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
radiusFn = function () { return radius; };
}
if (this.options.disableClusteringAtZoom) {
if (this.options.disableClusteringAtZoom !== null) {
maxZoom = this.options.disableClusteringAtZoom - 1;
}
this._maxZoom = maxZoom;
this._gridClusters = {};
this._gridUnclustered = {};
//Set up DistanceGrids for each zoom
for (var zoom = maxZoom; zoom >= 0; zoom--) {
for (var zoom = maxZoom; zoom >= minZoom; zoom--) {
this._gridClusters[zoom] = new L.DistanceGrid(radiusFn(zoom));
this._gridUnclustered[zoom] = new L.DistanceGrid(radiusFn(zoom));
}
// Instantiate the appropriate L.MarkerCluster class (animated or not).
this._topClusterLevel = new this._markerCluster(this, -1);
this._topClusterLevel = new this._markerCluster(this, minZoom - 1);
},
//Zoom: Zoom to start adding at (Pass this._maxZoom to start at the bottom)
_addLayer: function (layer, zoom) {
var gridClusters = this._gridClusters,
gridUnclustered = this._gridUnclustered,
minZoom = Math.floor(this._map.getMinZoom()),
markerPoint, z;
if (this.options.singleMarkerMode) {
this._overrideMarkerIcon(layer);
}
layer.on('move', this._childMarkerMoved, this);
layer.on(this._childMarkerEventHandlers, this);
//Find the lowest zoom level to slot this one in
for (; zoom >= 0; zoom--) {
for (; zoom >= minZoom; zoom--) {
markerPoint = this._map.project(layer.getLatLng(), zoom); // calculate pixel position
//Try find a cluster close by
@@ -1005,7 +1068,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
if (this._zoom < mapZoom && this._currentShownBounds.intersects(this._getExpandedVisibleBounds())) { //Zoom in, split
this._animationStart();
//Remove clusters now off screen
this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, this._zoom, this._getExpandedVisibleBounds());
this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, Math.floor(this._map.getMinZoom()), this._zoom, this._getExpandedVisibleBounds());
this._animationZoomIn(this._zoom, mapZoom);
@@ -1129,14 +1192,14 @@ L.MarkerClusterGroup.include({
//Do nothing...
},
_animationZoomIn: function (previousZoomLevel, newZoomLevel) {
this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, previousZoomLevel);
this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, Math.floor(this._map.getMinZoom()), previousZoomLevel);
this._topClusterLevel._recursivelyAddChildrenToMap(null, newZoomLevel, this._getExpandedVisibleBounds());
//We didn't actually animate, but we use this event to mean "clustering animations have finished"
this.fire('animationend');
},
_animationZoomOut: function (previousZoomLevel, newZoomLevel) {
this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, previousZoomLevel);
this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, Math.floor(this._map.getMinZoom()), previousZoomLevel);
this._topClusterLevel._recursivelyAddChildrenToMap(null, newZoomLevel, this._getExpandedVisibleBounds());
//We didn't actually animate, but we use this event to mean "clustering animations have finished"
@@ -1156,13 +1219,14 @@ L.MarkerClusterGroup.include({
_animationZoomIn: function (previousZoomLevel, newZoomLevel) {
var bounds = this._getExpandedVisibleBounds(),
fg = this._featureGroup,
fg = this._featureGroup,
minZoom = Math.floor(this._map.getMinZoom()),
i;
this._ignoreMove = true;
//Add all children of current clusters to map and remove those clusters from map
this._topClusterLevel._recursively(bounds, previousZoomLevel, 0, function (c) {
this._topClusterLevel._recursively(bounds, previousZoomLevel, minZoom, function (c) {
var startPos = c._latlng,
markers = c._markers,
m;
@@ -1212,7 +1276,7 @@ L.MarkerClusterGroup.include({
//Remove the old clusters and close the zoom animation
this._enqueue(function () {
//update the positions of the just added clusters/markers
this._topClusterLevel._recursively(bounds, previousZoomLevel, 0, function (c) {
this._topClusterLevel._recursively(bounds, previousZoomLevel, minZoom, function (c) {
fg.removeLayer(c);
c.clusterShow();
});
@@ -1227,7 +1291,7 @@ L.MarkerClusterGroup.include({
//Need to add markers for those that weren't on the map before but are now
this._topClusterLevel._recursivelyAddChildrenToMap(null, newZoomLevel, this._getExpandedVisibleBounds());
//Remove markers that were on the map before but won't be now
this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, previousZoomLevel, this._getExpandedVisibleBounds());
this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, Math.floor(this._map.getMinZoom()), previousZoomLevel, this._getExpandedVisibleBounds());
},
_animationAddLayer: function (layer, newCluster) {
@@ -1264,10 +1328,11 @@ L.MarkerClusterGroup.include({
// Private methods for animated versions.
_animationZoomOutSingle: function (cluster, previousZoomLevel, newZoomLevel) {
var bounds = this._getExpandedVisibleBounds();
var bounds = this._getExpandedVisibleBounds(),
minZoom = Math.floor(this._map.getMinZoom());
//Animate all of the markers in the clusters to move to their cluster center point
cluster._recursivelyAnimateChildrenInAndAddSelfToMap(bounds, previousZoomLevel + 1, newZoomLevel);
cluster._recursivelyAnimateChildrenInAndAddSelfToMap(bounds, minZoom, previousZoomLevel + 1, newZoomLevel);
var me = this;
@@ -1290,8 +1355,8 @@ L.MarkerClusterGroup.include({
m.clusterShow();
}
} else {
cluster._recursively(bounds, newZoomLevel, 0, function (c) {
c._recursivelyRemoveChildrenFromMap(bounds, previousZoomLevel + 1);
cluster._recursively(bounds, newZoomLevel, minZoom, function (c) {
c._recursivelyRemoveChildrenFromMap(bounds, minZoom, previousZoomLevel + 1);
});
}
me._animationEnd();
@@ -1320,12 +1385,13 @@ L.markerClusterGroup = function (options) {
return new L.MarkerClusterGroup(options);
};
var MarkerCluster = L.MarkerCluster = L.Marker.extend({
options: L.Icon.prototype.options,
L.MarkerCluster = L.Marker.extend({
initialize: function (group, zoom, a, b) {
L.Marker.prototype.initialize.call(this, a ? (a._cLatLng || a.getLatLng()) : new L.LatLng(0, 0), { icon: this });
L.Marker.prototype.initialize.call(this, a ? (a._cLatLng || a.getLatLng()) : new L.LatLng(0, 0),
{ icon: this, pane: group.options.clusterPane });
this._group = group;
this._zoom = zoom;
@@ -1347,7 +1413,7 @@ L.MarkerCluster = L.Marker.extend({
},
//Recursively retrieve all child markers of this cluster
getAllChildMarkers: function (storageArray) {
getAllChildMarkers: function (storageArray, ignoreDraggedMarker) {
storageArray = storageArray || [];
for (var i = this._childClusters.length - 1; i >= 0; i--) {
@@ -1355,6 +1421,9 @@ L.MarkerCluster = L.Marker.extend({
}
for (var j = this._markers.length - 1; j >= 0; j--) {
if (ignoreDraggedMarker && this._markers[j].__dragStart) {
continue;
}
storageArray.push(this._markers[j]);
}
@@ -1367,7 +1436,7 @@ L.MarkerCluster = L.Marker.extend({
},
//Zoom to the minimum of showing all of the child markers, or the extents of this cluster
zoomToBounds: function () {
zoomToBounds: function (fitBoundsOptions) {
var childClusters = this._childClusters.slice(),
map = this._group._map,
boundsZoom = map.getBoundsZoom(this._bounds),
@@ -1390,7 +1459,7 @@ L.MarkerCluster = L.Marker.extend({
} else if (boundsZoom <= mapZoom) { //If fitBounds wouldn't zoom us down, zoom us down instead
this._group._map.setView(this._latlng, mapZoom + 1);
} else {
this._group._map.fitBounds(this._bounds);
this._group._map.fitBounds(this._bounds, fitBoundsOptions);
}
},
@@ -1536,7 +1605,7 @@ L.MarkerCluster = L.Marker.extend({
},
_recursivelyAnimateChildrenIn: function (bounds, center, maxZoom) {
this._recursively(bounds, 0, maxZoom - 1,
this._recursively(bounds, this._group._map.getMinZoom(), maxZoom - 1,
function (c) {
var markers = c._markers,
i, m;
@@ -1564,8 +1633,8 @@ L.MarkerCluster = L.Marker.extend({
);
},
_recursivelyAnimateChildrenInAndAddSelfToMap: function (bounds, previousZoomLevel, newZoomLevel) {
this._recursively(bounds, newZoomLevel, 0,
_recursivelyAnimateChildrenInAndAddSelfToMap: function (bounds, mapMinZoom, previousZoomLevel, newZoomLevel) {
this._recursively(bounds, newZoomLevel, mapMinZoom,
function (c) {
c._recursivelyAnimateChildrenIn(bounds, c._group._map.latLngToLayerPoint(c.getLatLng()).round(), previousZoomLevel);
@@ -1573,7 +1642,7 @@ L.MarkerCluster = L.Marker.extend({
//As a hack we only do a animation free zoom on a single level zoom, if someone does multiple levels then we always animate
if (c._isSingleParent() && previousZoomLevel - 1 === newZoomLevel) {
c.clusterShow();
c._recursivelyRemoveChildrenFromMap(bounds, previousZoomLevel); //Immediately remove our children as we are replacing them. TODO previousBounds not bounds
c._recursivelyRemoveChildrenFromMap(bounds, mapMinZoom, previousZoomLevel); //Immediately remove our children as we are replacing them. TODO previousBounds not bounds
} else {
c.clusterHide();
}
@@ -1584,13 +1653,13 @@ L.MarkerCluster = L.Marker.extend({
},
_recursivelyBecomeVisible: function (bounds, zoomLevel) {
this._recursively(bounds, 0, zoomLevel, null, function (c) {
this._recursively(bounds, this._group._map.getMinZoom(), zoomLevel, null, function (c) {
c.clusterShow();
});
},
_recursivelyAddChildrenToMap: function (startPos, zoomLevel, bounds) {
this._recursively(bounds, -1, zoomLevel,
this._recursively(bounds, this._group._map.getMinZoom() - 1, zoomLevel,
function (c) {
if (zoomLevel === c._zoom) {
return;
@@ -1652,9 +1721,9 @@ L.MarkerCluster = L.Marker.extend({
},
//exceptBounds: If set, don't remove any markers/clusters in it
_recursivelyRemoveChildrenFromMap: function (previousBounds, zoomLevel, exceptBounds) {
_recursivelyRemoveChildrenFromMap: function (previousBounds, mapMinZoom, zoomLevel, exceptBounds) {
var m, i;
this._recursively(previousBounds, -1, zoomLevel - 1,
this._recursively(previousBounds, mapMinZoom - 1, zoomLevel - 1,
function (c) {
//Remove markers at every level
for (i = c._markers.length - 1; i >= 0; i--) {
@@ -1705,6 +1774,9 @@ L.MarkerCluster = L.Marker.extend({
if (zoom < zoomLevelToStart || zoom < zoomLevelToStop) {
for (i = childClusters.length - 1; i >= 0; i--) {
c = childClusters[i];
if (c._boundsNeedUpdate) {
c._recalculateBounds();
}
if (boundsToApplyTo.intersects(c._bounds)) {
c._recursively(boundsToApplyTo, zoomLevelToStart, zoomLevelToStop, runAtEveryLevel, runAtBottomLevel);
}
@@ -1719,36 +1791,27 @@ L.MarkerCluster = L.Marker.extend({
}
});
/*
* Extends L.Marker to include two extra methods: clusterHide and clusterShow.
*
* They work as setOpacity(0) and setOpacity(1) respectively, but
* they will remember the marker's opacity when hiding and showing it again.
* don't overwrite the options.opacity
*
*/
L.Marker.include({
clusterHide: function () {
this.options.opacityWhenUnclustered = this.options.opacity || 1;
return this.setOpacity(0);
var backup = this.options.opacity;
this.setOpacity(0);
this.options.opacity = backup;
return this;
},
clusterShow: function () {
var ret = this.setOpacity(this.options.opacity || this.options.opacityWhenUnclustered);
delete this.options.opacityWhenUnclustered;
return ret;
return this.setOpacity(this.options.opacity);
}
});
L.DistanceGrid = function (cellSize) {
this._cellSize = cellSize;
this._sqCellSize = cellSize * cellSize;
@@ -1842,7 +1905,8 @@ L.DistanceGrid.prototype = {
for (k = 0, len = cell.length; k < len; k++) {
obj = cell[k];
dist = this._sqDist(objectPoint[L.Util.stamp(obj)], point);
if (dist < closestDistSq) {
if (dist < closestDistSq ||
dist <= closestDistSq && closest === null) {
closestDistSq = dist;
closest = obj;
}
@@ -1855,7 +1919,8 @@ L.DistanceGrid.prototype = {
},
_getCoord: function (x) {
return Math.floor(x / this._cellSize);
var coord = Math.floor(x / this._cellSize);
return isFinite(coord) ? coord : x;
},
_sqDist: function (p, p2) {
@@ -1865,7 +1930,6 @@ L.DistanceGrid.prototype = {
}
};
/* Copyright (c) 2012 the authors listed at the following URL, and/or
the authors of referenced articles or incorporated external code:
http://en.literateprograms.org/Quickhull_(Javascript)?action=history&offset=20120410175256
@@ -2032,7 +2096,6 @@ L.MarkerCluster.include({
}
});
//This code is 100% based on https://github.com/jawj/OverlappingMarkerSpiderfier-Leaflet
//Huge thanks to jawj for implementing it first to make my job easy :-)
@@ -2040,7 +2103,7 @@ L.MarkerCluster.include({
_2PI: Math.PI * 2,
_circleFootSeparation: 25, //related to circumference of circle
_circleStartAngle: Math.PI / 6,
_circleStartAngle: 0,
_spiralFootSeparation: 28, //related to size of spiral (experiment!)
_spiralLengthStart: 11,
@@ -2054,7 +2117,7 @@ L.MarkerCluster.include({
return;
}
var childMarkers = this.getAllChildMarkers(),
var childMarkers = this.getAllChildMarkers(null, true),
group = this._group,
map = group._map,
center = map.latLngToLayerPoint(this._latlng),
@@ -2092,9 +2155,11 @@ L.MarkerCluster.include({
res = [],
i, angle;
legLength = Math.max(legLength, 35); // Minimum distance to get outside the cluster icon.
res.length = count;
for (i = count - 1; i >= 0; i--) {
for (i = 0; i < count; i++) { // Clockwise, like spiral.
angle = this._circleStartAngle + i * angleStep;
res[i] = new L.Point(centerPt.x + legLength * Math.cos(angle), centerPt.y + legLength * Math.sin(angle))._round();
}
@@ -2114,9 +2179,13 @@ L.MarkerCluster.include({
res.length = count;
// Higher index, closer position to cluster center.
for (i = count - 1; i >= 0; i--) {
for (i = count; i >= 0; i--) {
// Skip the first position, so that we are already farther from center and we avoid
// being under the default cluster icon (especially important for Circle Markers).
if (i < count) {
res[i] = new L.Point(centerPt.x + legLength * Math.cos(angle), centerPt.y + legLength * Math.sin(angle))._round();
}
angle += separation / legLength + i * 0.0005;
res[i] = new L.Point(centerPt.x + legLength * Math.cos(angle), centerPt.y + legLength * Math.sin(angle))._round();
legLength += lengthFactor / angle;
}
return res;
@@ -2126,7 +2195,7 @@ L.MarkerCluster.include({
var group = this._group,
map = group._map,
fg = group._featureGroup,
childMarkers = this.getAllChildMarkers(),
childMarkers = this.getAllChildMarkers(null, true),
m, i;
group._ignoreMove = true;
@@ -2319,7 +2388,7 @@ L.MarkerCluster.include({
map = group._map,
fg = group._featureGroup,
thisLayerPos = zoomDetails ? map._latLngToNewLayerPoint(this._latlng, zoomDetails.zoom, zoomDetails.center) : map.latLngToLayerPoint(this._latlng),
childMarkers = this.getAllChildMarkers(),
childMarkers = this.getAllChildMarkers(null, true),
svg = L.Path.SVG,
m, i, leg, legPath, legLength, nonAnimatable;
@@ -2336,6 +2405,9 @@ L.MarkerCluster.include({
continue;
}
//Close any popup on the marker first, otherwise setting the location of the marker will make the map scroll
m.closePopup();
//Fix up the location to the real one
m.setLatLng(m._preSpiderfyLatlng);
delete m._preSpiderfyLatlng;
@@ -2500,7 +2572,6 @@ L.MarkerClusterGroup.include({
}
});
/**
* Adds 1 public method to MCG and 1 to L.Marker to facilitate changing
* markers' icon options and refreshing their icon and their parent clusters
@@ -2612,5 +2683,8 @@ L.Marker.include({
}
});
exports.MarkerClusterGroup = MarkerClusterGroup;
exports.MarkerCluster = MarkerCluster;
}(window, document));
})));
//# sourceMappingURL=leaflet.markercluster-src.js.map

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,22 +1,43 @@
{
"name": "leaflet.markercluster",
"repository": "https://github.com/Leaflet/Leaflet.markercluster",
"version": "1.0.0",
"version": "1.4.1",
"description": "Provides Beautiful Animated Marker Clustering functionality for Leaflet",
"devDependencies": {
"jshint": "~2.1.3",
"mocha": "~1.10.0",
"karma": "~0.8.5",
"uglify-js": "~2.3.6",
"git-rev-sync": "^1.8.0",
"happen": "^0.3.1",
"jake": "~0.5.16",
"magic-string": "^0.7.0",
"leaflet": "~1.0.0-rc.1"
"jshint": "^2.9.4",
"karma": "^1.5.0",
"karma-chrome-launcher": "^2.0.0",
"karma-coverage": "^1.1.1",
"karma-firefox-launcher": "^1.0.1",
"karma-mocha": "^1.3.0",
"karma-phantomjs-launcher": "^1.0.4",
"karma-rollup-plugin": "^0.2.4",
"karma-safari-launcher": "^1.0.0",
"leaflet": "^1.3.1",
"mocha": "~1.10.0",
"phantomjs-prebuilt": "^2.1.14",
"rollup": "^0.41.4",
"rollup-plugin-git-version": "0.2.1",
"rollup-plugin-json": "^2.1.0",
"uglify-js": "~2.3.6"
},
"main": "dist/leaflet.markercluster.js",
"peerDependencies": {
"leaflet": "~1.3.1"
},
"main": "dist/leaflet.markercluster-src.js",
"scripts": {
"test": "jake test",
"prepublish": "jake"
"test": "karma start ./spec/karma.conf.js",
"prepublish": "jake",
"rollup": "rollup -c build/rollup-config.js",
"uglify": "uglifyjs dist/leaflet.markercluster-src.js -c -m -o dist/leaflet.markercluster.js --source-map dist/leaflet.markercluster.js.map --in-source-map dist/leaflet.markercluster-src.js.map --source-map-url leaflet.markercluster.js.map"
},
"keywords": ["gis", "map"],
"keywords": [
"gis",
"map",
"cluster"
],
"license": "MIT"
}

View File

@@ -1,3 +1,12 @@
## 0.3.4
* From now on, the repository doesn't contain leaflet-omnivore.js or leaflet-omnivore.min.js. Those
files will be in the npm package and you can use unpkg.com to get them.
## 0.3.3
* Call either `setGeoJSON` or `addData` on GeoJSON layers, not both.
## 0.3.2
* Move `brfs` and `hintify` to dependencies.

View File

@@ -1,5 +1,3 @@
[![Build Status](https://travis-ci.org/mapbox/leaflet-omnivore.svg)](https://travis-ci.org/mapbox/leaflet-omnivore)
# leaflet-omnivore
![](https://farm8.staticflickr.com/7373/12376158164_e335b4e61d_b.jpg)
@@ -24,7 +22,7 @@ so you can specify what you want to add to the map with just a URL.
use it easily with the [Mapbox Plugins CDN](http://mapbox.com/mapbox.js/plugins/#leaflet-omnivore):
```html
<script src='//api.tiles.mapbox.com/mapbox.js/plugins/leaflet-omnivore/v0.2.0/leaflet-omnivore.min.js'></script>
<script src='//api.tiles.mapbox.com/mapbox.js/plugins/leaflet-omnivore/v0.3.1/leaflet-omnivore.min.js'></script>
```
@@ -43,7 +41,7 @@ Live examples:
* [CSV](https://www.mapbox.com/mapbox.js/example/v1.0.0/markers-from-csv/)
```js
var map = L.mapbox.map('map', 'examples.map-9ijuk24y')
var map = L.mapbox.map('map', 'mapbox.streets')
.setView([38, -102.0], 5);
omnivore.csv('a.csv').addTo(map);

View File

@@ -1,5 +0,0 @@
{
"name": "leaflet-omnivore",
"version": "0.3.0",
"description": "a geospatial format parser for Leaflet"
}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -1,22 +1,26 @@
{
"name": "leaflet-omnivore",
"version": "0.3.2",
"version": "0.3.4",
"description": "a geospatial format parser for Leaflet",
"main": "index.js",
"scripts": {
"test": "zuul --local -- test/test.js",
"test-remote": "zuul -- test/test.js",
"test-headless": "zuul --phantom test/test.js",
"build": "browserify -s omnivore index.js > leaflet-omnivore.js && uglifyjs leaflet-omnivore.js -c -m > leaflet-omnivore.min.js"
"test-headless": "zuul --phantom -- test/test.js",
"prepublish": "browserify -s omnivore index.js > leaflet-omnivore.js && uglifyjs leaflet-omnivore.js -c -m > leaflet-omnivore.min.js"
},
"repository": {
"type": "git",
"url": "git@github.com:mapbox/leaflet-omnivore.git"
},
"files": [
"index.js",
"leaflet-omnivore.js",
"leaflet-omnivore.min.js"
],
"browserify": {
"transform": [
"brfs",
"hintify"
"brfs"
]
},
"keywords": [
@@ -38,30 +42,29 @@
"converter"
],
"author": "Tom MacWright",
"license": "BSD",
"license": "BSD-3-Clause",
"bugs": {
"url": "https://github.com/mapbox/leaflet-omnivore/issues"
},
"homepage": "https://github.com/mapbox/leaflet-omnivore",
"dependencies": {
"csv2geojson": "~3.6.1",
"togeojson": "0.10.1",
"corslite": "0.0.6",
"wellknown": "0.3.0",
"hintify": "~0.1.0",
"brfs": "0.2.1",
"topojson": "1.6.8",
"polyline": "0.0.3"
"csv2geojson": "~5.0.0",
"togeojson": "0.13.0",
"corslite": "0.0.7",
"wellknown": "0.4.2",
"brfs": "1.4.3",
"topojson": "1.6.26",
"polyline": "0.2.0"
},
"devDependencies": {
"browserify": "7.0.2",
"tape": "2.4.2",
"uglify-js": "2.4.16",
"jshint": "2.5.0",
"mocha": "~1.20.1",
"zuul": "~1.7.0",
"st": "0.5.1",
"mapbox.js": "1.6.4",
"phantomjs": "~1.9.7-15"
"browserify": "13.0.1",
"tape": "4.5.1",
"uglify-js": "^2.6.2",
"jshint": "2.9.2",
"mocha": "~2.5.3",
"zuul": "~3.10.1",
"st": "1.1.0",
"mapbox.js": "2.4.0",
"phantomjs-prebuilt": "2.1.7"
}
}

View File

@@ -0,0 +1,122 @@
.marker-icon,
.marker-icon:focus {
background-color: #ffffff;
border: 1px solid #3388ff;
border-radius: 50%;
margin: -8px 0 0 -8px !important;
width: 14px !important;
height: 14px !important;
outline: 0;
transition: opacity ease 0.3s;
}
.marker-icon-middle,
.marker-icon-middle:focus {
opacity: 0.7;
margin: -6px 0 0 -6px !important;
width: 10px !important;
height: 10px !important;
}
.leaflet-pm-draggable {
cursor: move !important;
}
.cursor-marker {
cursor: crosshair;
pointer-events: none;
display: none;
}
.cursor-marker.visible {
display: block !important;
}
.leaflet-pm-invalid {
stroke: red;
transition: fill ease 0s, stroke ease 0s;
}
.rect-style-marker,
.rect-start-marker {
opacity: 0;
}
.rect-style-marker.visible,
.rect-start-marker.visible {
opacity: 1 !important;
}
.hidden {
display: none;
}
.leaflet-pm-toolbar {
}
.leaflet-pm-toolbar .leaflet-buttons-control-button {
padding: 3px;
box-sizing: border-box;
}
.leaflet-pm-toolbar .control-icon {
width: 100%;
height: 100%;
box-sizing: border-box;
opacity: .8;
background-size: contain;
background-repeat: no-repeat;
background-position: center center;
}
.leaflet-pm-toolbar .leaflet-pm-icon-marker {
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAAZCAYAAADTyxWqAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAABAhpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMDY3IDc5LjE1Nzc0NywgMjAxNS8wMy8zMC0yMzo0MDo0MiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3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Q4YWI1NzNmIiBzdFJlZjpkb2N1bWVudElEPSJhZG9iZTpkb2NpZDpwaG90b3Nob3A6YzRkZmQxMGMtY2NlNS0xMTc4LWE5OGQtY2NkZmM5ODk5YWYwIi8+IDxkYzp0aXRsZT4gPHJkZjpBbHQ+IDxyZGY6bGkgeG1sOmxhbmc9IngtZGVmYXVsdCI+Z2x5cGhpY29uczwvcmRmOmxpPiA8L3JkZjpBbHQ+IDwvZGM6dGl0bGU+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+J3lsvQAAAFpJREFUeNrsljsOACAIQ1sPyGG9IJq4IKOfQdNuhuQ90gUJwBHi7sRGSE48DuaA5uFqIq/gcpgr6rFNZo2Pkjq3A0tbrOp6RRJIIIEEEjxxcD68yae/LU2AAQC7fSa9H1rL6AAAAABJRU5ErkJggg==);
background-size: 90%;
}
.leaflet-pm-toolbar .leaflet-pm-icon-drag {
/*background-image: url('../assets/icons/drag.png');*/
}
.leaflet-pm-toolbar .leaflet-pm-icon-delete {
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAaCAYAAAC3g3x9AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAABAhpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMDY3IDc5LjE1Nzc0NywgMjAxNS8wMy8zMC0yMzo0MDo0MiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcm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cCBDQyAyMDE1IChNYWNpbnRvc2gpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6MTk5NzA1OGEtZDI3OC00NDZkLWE4ODgtNGM4MGQ4YWI1NzNmIiBzdFJlZjpkb2N1bWVudElEPSJhZG9iZTpkb2NpZDpwaG90b3Nob3A6YzRkZmQxMGMtY2NlNS0xMTc4LWE5OGQtY2NkZmM5ODk5YWYwIi8+IDxkYzp0aXRsZT4gPHJkZjpBbHQ+IDxyZGY6bGkgeG1sOmxhbmc9IngtZGVmYXVsdCI+Z2x5cGhpY29uczwvcmRmOmxpPiA8L3JkZjpBbHQ+IDwvZGM6dGl0bGU+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+UbC4LAAAATFJREFUeNrUVosRgyAMhU5gN3AER3AER2AER7AbOIIjdAS7gSO4Qd2AEu+ll6JYP9i75i4nIrxHkgeorbVKa50opYxzevbO765/ULGMSJy11BROBBV9i+FkuQBu8GSyOhYJR1GJzpqJYpBogJFduQ6o0RPp1EdLIkluSA8T2T0kWGDhPEVX85EaLjiUtjpdACxnBETe8aAS0vUH2AXgDAucnQdvR2F5E83MJHo3YkzuKTAI/p4TWKUZw5ySVdiwKaLwySj/2QTvS65zkedBOJMlaBN4GsRZWViL6IwnknoJfG0kmSAZFmqxPRKvJgYpGbYAB0kC6urE9wJy51O7F5HaUHv3Ptl6QB7e8WtImGCUpaeo/zmFL84faJeiv1KR7fyb8Rd3vObquzqUZ/2tvAQYANwXksvfGBuLAAAAAElFTkSuQmCC);
background-size: 80%;
background-position: 4px center;
}
.leaflet-buttons-control-button:hover {
cursor: pointer;
background-color: #f4f4f4;
}
.leaflet-buttons-control-button.active {
background-color: #f4f4f4;
}
.leaflet-buttons-control-button.active > .control-icon {
opacity: .5;
}
.leaflet-buttons-control-text-hide {
display: none;
}

1
assets/leaflet-pm/leaflet.pm.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -1,9 +1,130 @@
# Leaflet-providers changelog
## 1.13.0 (2021-10-19)
- Add Azure Maps Tiles provider [#384](https://github.com/leaflet-extras/leaflet-providers/pull/384)
- Fix nlmaps attribution link [#386](https://github.com/leaflet-extras/leaflet-providers/pull/386)
- Update nlmaps.luchtfoto tiles url [#390](https://github.com/leaflet-extras/leaflet-providers/pull/390)
- Update NASAGIBS.ModisTerraSnowCover tiles url [#391](https://github.com/leaflet-extras/leaflet-providers/pull/391)
- Upgrade dependencies, add dependabot for npm/github actions [#392](https://github.com/leaflet-extras/leaflet-providers/pull/392)
- Switch JusticeMap and OpenAIP to https, remove GeoportailFrance.ignMaps from index.html [#393](https://github.com/leaflet-extras/leaflet-providers/pull/393)
- Replace OpenPtMap overlay by OPNVKarte layer [#396](https://github.com/Replace OpenPtMap overlay by OPNVKarte layer/pull/396)
- Updated maxzoom for CartoDB [#403](https://github.com/leaflet-extras/leaflet-providers/pull/403)
- Multiple dependencies updated by @dependabot
## 1.12.0 (2021-04-02)
- Add OpenAIP map provider [#374](https://github.com/leaflet-extras/leaflet-providers/pull/374)
- Migrate from travis to github actions [#375](https://github.com/leaflet-extras/leaflet-providers/pull/375)
- Fix typo in OpenStreetMap France attribution [#378](https://github.com/leaflet-extras/leaflet-providers/pull/378)
- Add OpenSnowMap map provider [#379](https://github.com/leaflet-extras/leaflet-providers/pull/379)
- Improve Geoportail resources [#382](https://github.com/leaflet-extras/leaflet-providers/pull/382)
- Remove Wikimedia map provider [#383](https://github.com/leaflet-extras/leaflet-providers/pull/383)
## 1.11.0 (2020-11-16)
- Update example Mapbox map_ID [#365](https://github.com/leaflet-extras/leaflet-providers/pull/365)
- Add USGS National Map tiles [#367](https://github.com/leaflet-extras/leaflet-providers/pull/367)
- Update preview libs and use leaflet 1.7.1 [#370](https://github.com/leaflet-extras/leaflet-providers/pull/370)
- Add Waymarked Trails overlay provider [#373](https://github.com/leaflet-extras/leaflet-providers/pull/373)
## 1.10.2 (2020-07-31)
- Update mversion dep [#357](https://github.com/leaflet-extras/leaflet-providers/pull/357)
- Mention stadia resitration in in README.md
- Update freemap.sk tiles url [#359](https://github.com/leaflet-extras/leaflet-providers/pull/357)
- Switch unpkg ressources to https on demo page [#361](https://github.com/leaflet-extras/leaflet-providers/pull/361)
- Update demo page and test pages to leaflet 1.6.0
- New (non dev) URLs for CyclOSM tiles [#363](https://github.com/leaflet-extras/leaflet-providers/pull/363)
## 1.10.1 (2020-05-18)
- Exclude MapTiler from demo
- Refine #348 : don't put jawg token in dist file
## 1.10.0 (2020-05-17)
- Add HERE API v3 [#343](https://github.com/leaflet-extras/leaflet-providers/pull/343)
- Add Stadia Maps layers [#344](https://github.com/leaflet-extras/leaflet-providers/pull/344)
- Updated Hydda layers maxZoom to 20 [#347](https://github.com/leaflet-extras/leaflet-providers/pull/347)
- Add Jawg Maps layers [#348](https://github.com/leaflet-extras/leaflet-providers/pull/348)
- Updated Mapbox to new static tiles api [#352](https://github.com/leaflet-extras/leaflet-providers/pull/352)
- Removed OpenMapSurfer layers [#354](https://github.com/leaflet-extras/leaflet-providers/pull/354)
- Add MapTiler Cloud layers [#355](https://github.com/leaflet-extras/leaflet-providers/pull/355)
## 1.9.1 (2019-12-06)
- Add Cyclosm layer [#335](https://github.com/leaflet-extras/leaflet-providers/pull/335)
- Fix nlmaps.luchtfoto url [#339](https://github.com/leaflet-extras/leaflet-providers/pull/339)
- basemapAT: add terrain, surface layers [#340](https://github.com/leaflet-extras/leaflet-providers/pull/340)
## 1.9.0 (2019-08-30)
- Add TomTom layers [#329](https://github.com/leaflet-extras/leaflet-providers/pull/329)
- Add Stamen.TerrainLabels overlay [#331](https://github.com/leaflet-extras/leaflet-providers/pull/331)
- Add HERE traffic tiles to normal and hybrid [#332](https://github.com/leaflet-extras/leaflet-providers/pull/332)
## 1.8.0 (2019-06-13)
- Removed OSM B&W layer from example file
- Removed bower.json file
- Add support for Thunderforest `Mobile Atlas` and `Neighbourhood` map variants [#325](https://github.com/leaflet-extras/leaflet-providers/pull/325)
## 1.7.0 (2019-05-14)
- Additional OpenMapSurfer layers & updated url for tiles [#322](https://github.com/leaflet-extras/leaflet-providers/pull/322)
## 1.6.0 (2019-03-28)
- Tile attribution improvements [#309](https://github.com/leaflet-extras/leaflet-providers/pull/309)
- Updated openmapsurfer tiles url [#310](https://github.com/leaflet-extras/leaflet-providers/pull/310)
- Switched wmflbs.org tiles to https [#311](https://github.com/leaflet-extras/leaflet-providers/pull/311)
- Removed OpenStreetMap Black and white [#319](https://github.com/leaflet-extras/leaflet-providers/pull/319)
## 1.5.0 (2018-11-06)
- Prevented redirect in Stamen [#299](https://github.com/leaflet-extras/leaflet-providers/pull/299)
- Fixed default mapbox layer [#303](https://github.com/leaflet-extras/leaflet-providers/pull/303)
- Updated CartoDB -> CARTO [#305](https://github.com/leaflet-extras/leaflet-providers/pull/305)
- Removed OpenInfraMap [#306](https://github.com/leaflet-extras/leaflet-providers/pull/306)
- Updated HERE url & comments [#307](https://github.com/leaflet-extras/leaflet-providers/pull/307)
## 1.4.0 (2018-08-25)
- Added [`OneMapSG`](http://leaflet-extras.github.io/leaflet-providers/preview/#filter=OneMapSG), [#295](https://github.com/leaflet-extras/leaflet-providers/pull/295)
## 1.3.1 (2018-06-20)
- No retina tiles for `Stamen.Watercolor` & `TopOSMRelief` [#286](https://github.com/leaflet-extras/leaflet-providers/pull/286)
## 1.3.0 (2018-06-16)
- Added `GeoportailFrance` provider [284](https://github.com/leaflet-extras/leaflet-providers/pull/284)
- Removed mention to protocol relativity in README.md
## 1.2.0 (2018-06-05)
- Make preview usable locally [#256](https://github.com/leaflet-extras/leaflet-providers/pull/256)
- Always use https when available [#258](https://github.com/leaflet-extras/leaflet-providers/pull/258)
- Added API Key for OpenWeatherMap [#260](https://github.com/leaflet-extras/leaflet-providers/pull/260)
- Fixed attribution of basemap.at [#261](https://github.com/leaflet-extras/leaflet-providers/pull/261)
- Added installation instructions [#263](https://github.com/leaflet-extras/leaflet-providers/pull/263)
- Added `Wikimedia` provider [#266](https://github.com/leaflet-extras/leaflet-providers/pull/266)
- Added `OpenInfraMap`/ `OpenPtMap` / `OpenRailwayMap` / `OpenFireMap` / `SafeCast` [#266](https://github.com/leaflet-extras/leaflet-providers/pull/266)
- Switched osm bzh to https [#269](https://github.com/leaflet-extras/leaflet-providers/pull/269)
- Added `OpenStreetMap.CH` bounding box + `Wikimedia` retina parameter and correct maxZoom [#271](https://github.com/leaflet-extras/leaflet-providers/pull/271)
- Fixed test for providers keys
- Mention leaflet in usage example in README.md
- Removed mention to `force_http` in README.md [#273](https://github.com/leaflet-extras/leaflet-providers/pull/273)
- Added informations about Thunderforest key in README.md [#277](https://github.com/leaflet-extras/leaflet-providers/pull/277)
- Added retina support for `MapBox` [#280](https://github.com/leaflet-extras/leaflet-providers/pull/280)
- Added `CartoDB.Voyager` variants `MapBox` [#281](https://github.com/leaflet-extras/leaflet-providers/pull/281)
- Removed homegrown retina detection and added retina support for `CartoDB` & `Stamen`
## 1.1.17 (2017-06-29)
- Added `maxZoom` for `Hydda` provider [242](https://github.com/leaflet-extras/leaflet-providers/pull/242)
- Fixed `maxZoom` for all layers from the `thunderforest` provider
- Added protocol relativity to the url for `OpenStreetMap.DE` variant.
- Added `OpenStreetMap.BZH` [#255](https://github.com/leaflet-extras/leaflet-providers/pull/255)
- Added `nlmaps` provider [#254](https://github.com/leaflet-extras/leaflet-providers/pull/254)
## 1.1.16 (2016-11-04)
- Updates to reflect changes in [BasemapAT](http://leaflet-extras.github.io/leaflet-providers/preview/#filter=BasemapAT) by [@ximex](https://github.com/ximex), [#232](https://github.com/leaflet-extras/leaflet-providers/pull/232), [#233](https://github.com/leaflet-extras/leaflet-providers/pull/233)
- Bump leaflet version in tests and preview to 1.0.1.
- Added some layers from http://justicemap.org [#224](https://github.com/leaflet-extras/leaflet-providers/pull/224).
## 1.1.15 (2016-08-09)
- [Stamen terrain](http://leaflet-extras.github.io/leaflet-providers/preview/#filter=Stamen.Terrain) now has world coverage [#223](https://github.com/leaflet-extras/leaflet-providers/pull/223)
- OSM France `maxZoom`: 20 ([#222](https://github.com/leaflet-extras/leaflet-providers/pull/222), fixes [#221](https://github.com/leaflet-extras/leaflet-providers/issues/221))
## 1.1.14 (2016-07-15)
- Remove MapQuest, fixes #219
- Accidently skipped v1.1.12 and v1.1.13
- Remove MapQuest, fixes #219
- Accidently skipped v1.1.12 and v1.1.13
## 1.1.11 (2016-06-04)
- Added protocol relativity to OSM FR, OSM HOT and Hydda providers (#214, #215).

View File

@@ -6,5 +6,5 @@ rules:
- Don't violate a providers TOS (if it exists, include a link to it)
- Don't pre-populate api keys with working keys.
- It should be a basic tile source, no exteral libraries etc.
- The owner hasn't asked us to remove it (hasn't happened yet)
- It should be a basic tile source, no external libraries etc.
- The owner hasn't asked us to remove it (hasn't happened yet)

View File

@@ -2,23 +2,25 @@ Leaflet-providers
=================
An extension to [Leaflet](http://leafletjs.com/) that contains configurations for various free<sup>[1](#what-is-free)</sup> tile providers.
# Installation
Download [leaflet-providers.js](https://raw.githubusercontent.com/leaflet-extras/leaflet-providers/master/leaflet-providers.js) and include it in your page after including Leaflet, e.g.:
<head>
...
<script src="http://unpkg.com/leaflet@1.7.1/dist/leaflet.js"></script>
<script src="js/leaflet-providers.js"></script>
</head>
# Usage
Leaflet-providers [providers](#providers) are refered to with a `provider[.<variant>]`-string. Let's say you want to add the nice [Watercolor](http://maps.stamen.com/#watercolor/) style from Stamen to your map, you pass `Stamen.Watercolor` to the `L.tileLayer.provider`-constructor, which will return a [L.TileLayer](http://leafletjs.com/reference.html#tilelayer) instance for Stamens Watercolor tile layer.
Leaflet-providers [providers](#providers) are referred to with a `provider[.<variant>]`-string. Let's say you want to add the nice [Watercolor](http://maps.stamen.com/#watercolor/) style from Stamen to your map, you pass `Stamen.Watercolor` to the `L.tileLayer.provider`-constructor, which will return a [L.TileLayer](http://leafletjs.com/reference.html#tilelayer) instance for Stamens Watercolor tile layer.
```Javascript
// add Stamen Watercolor to map.
L.tileLayer.provider('Stamen.Watercolor').addTo(map);
```
## Protocol relativity (`https://`-urls)
Leaflet-providers tries to use `https://` if the page uses `https://` and the provider supports it.
You can force the use of `http://` by passing `force_http: true` in the options argument.
## Retina tiles
Some providers have retina tiles for which the URL only needs to be slightly adjusted, e.g. `-----@2x.png`. For this, add the retina option in the URL, e.g. `-----{retina}.png`, and set a retina value in the options, e.g. `retina: '@2x'`. If Leaflet detects a retina screen (`L.Browser.retina`), the retina option passed to the tileLayer is set to the value supplied, otherwise it's replaced by an empty string.
# Providers
Leaflet-providers provides tile layers from different providers, including *OpenStreetMap*, *Stamen*, *Esri* and *OpenWeatherMap*. The full listing of free to use layers can be [previewed](http://leaflet-extras.github.io/leaflet-providers/preview/index.html). The page will show you the name to use with `leaflet-providers.js` and the code to use it without dependencies.
@@ -27,9 +29,17 @@ Leaflet-providers provides tile layers from different providers, including *Open
In addition to the providers you are free<b id="what-is-free">1</b> to use, we support some layers which require registration.
### HERE (formerly Nokia).
### HERE and HEREv3 (formerly Nokia).
In order to use HERE layers, you must [register](http://developer.here.com/). Once registered, you can create an `app_id` and `app_code` which you have to pass to `L.tileLayer.provider` in the options:
In order to use HEREv3 layers, you must [register](http://developer.here.com/). Once registered, you can create an `apiKey` which you have to pass to `L.tileLayer.provider` in the options:
```Javascript
L.tileLayer.provider('HEREv3.terrainDay', {
apiKey: '<insert apiKey here>'
}).addTo(map);
```
You can still pass `app_id` and `app_code` in legacy projects:
```Javascript
L.tileLayer.provider('HERE.terrainDay', {
@@ -38,13 +48,43 @@ L.tileLayer.provider('HERE.terrainDay', {
}).addTo(map);
```
[Available HERE layers](http://leaflet-extras.github.io/leaflet-providers/preview/#filter=HERE)
### Jawg Maps
In order to use Jawg Maps, you must [register](https://www.jawg.io/lab). Once registered, your access token will be located [here](https://www.jawg.io/lab/access-tokens) and you will access to all Jawg default maps (variants) and your own customized maps :
```JavaScript
L.tileLayer.provider('Jawg.Streets', {
variant: '<insert map id here or blank for default variant>',
accessToken: '<insert access token here>'
}).addTo(map);
```
### Mapbox
In order to use Mapbox maps, you must [register](https://tiles.mapbox.com/signup). You can get map ID and ACCESS_TOKEN from [Mapbox projects](https://www.mapbox.com/projects):
In order to use Mapbox maps, you must [register](https://tiles.mapbox.com/signup). You can get map_ID (e.g. "mapbox/satellite-v9") and ACCESS_TOKEN from [Mapbox projects](https://www.mapbox.com/projects):
```JavaScript
L.tileLayer.provider('MapBox', {id: 'ID', accessToken: 'ACCESS_TOKEN'}).addTo(map);
L.tileLayer.provider('MapBox', {
id: '<insert map_ID here>',
accessToken: '<insert ACCESS_TOKEN here>'
}).addTo(map);
```
The currently-valid Mapbox map styles, to use for map_IDs, [are listed in the Mapbox documentation](https://docs.mapbox.com/api/maps/#mapbox-styles) - only the final part of each is required, e.g. "mapbox/light-v10".
### MapTiler Cloud
In order to use MapTiler maps, you must [register](https://cloud.maptiler.com/). Once registered, get your API key from Account->Keys, which you have to pass to `L.tileLayer.provider` in the options:
```JavaScript
L.tileLayer.provider('MapTiler.Streets', {
key: '<insert key here>'
}).addTo(map);
```
### Thunderforest
In order to use Thunderforest maps, you must [register](https://thunderforest.com/pricing/). Once registered, you have an `api_key` which you have to pass to `L.tileLayer.provider` in the options:
```JavaScript
L.tileLayer.provider('Thunderforest.Landscape', {apikey: '<insert api_key here>'}).addTo(map);
```
### Esri/ArcGIS
@@ -53,6 +93,34 @@ In order to use ArcGIS maps, you must [register](https://developers.arcgis.com/e
[Available Esri layers](http://leaflet-extras.github.io/leaflet-providers/preview/#filter=Esri)
### TomTom
In order to use TomTom layers, you must [register](https://developer.tomtom.com/user/register). Once registered, you can create an `apikey` which you have to pass to `L.tileLayer.provider` in the options:
```Javascript
L.tileLayer.provider('TomTom', {
apikey: '<insert your API key here>'
}).addTo(map);
```
### Geoportail France
In order to use Geoportail France resources, you need to obtain an [api key]( http://professionnels.ign.fr/ign/contrats/) that allows you to access the [resources](https://geoservices.ign.fr/documentation/donnees-ressources-wmts.html#ressources-servies-en-wmts-en-projection-web-mercator) you need. Pass this api key and the ID of the resource to display to `L.tileLayer.provider` in the options:
```JavaScript
L.tileLayer.provider('GeoportailFrance', {
variant: '<insert resource ID here>',
apikey: '<insert api key here>'
}).addTo(map);
```
Please note that a public api key (`choisirgeoportail`) is used by default and comes with no guarantee.
4 aliases are also provided for common Geoportail resources : `GeoportailFrance`, `GeoportailFrance.orthos`, `GeoportailFrance.ignMaps` and `GeoportailFrance.parcels` (See index.html demo).
### Stadia Maps
In order to use Stadia maps, you must [register](https://client.stadiamaps.com/signup/). Once registered, you can whitelist your domain within your account settings.
# Attribution
This work was inspired from <https://gist.github.com/1804938>, and originally created by [Stefan Seelmann](https://github.com/seelmann).

View File

@@ -1,25 +0,0 @@
{
"name": "leaflet-providers",
"version": "1.1.15",
"homepage": "https://github.com/leaflet-extras/leaflet-providers",
"description": "An extension to Leaflet that contains configurations for various free tile providers.",
"dependencies": {
"leaflet": "~0.7.3"
},
"main": "leaflet-providers.js",
"keywords": [
"leaflet",
"stamen",
"osm"
],
"license": "BSD-2-Clause",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests",
"preview",
"*.html"
]
}

View File

@@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<!-- Leaflet style. REQUIRED! -->
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/leaflet/1.0.0-rc.1/leaflet.css" />
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css" />
<style>
html { height: 100% }
body { height: 100%; margin: 0; padding: 0;}
@@ -26,7 +26,7 @@
</div>
<div id="map" class="map"></div>
<script src="//cdnjs.cloudflare.com/ajax/libs/leaflet/1.0.0-rc.1/leaflet.js"></script>
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"></script>
<script src="leaflet-providers.js"></script>
<script>
var map = L.map('map', {
@@ -40,16 +40,16 @@
var baseLayers = {
'OpenStreetMap Default': defaultLayer,
'OpenStreetMap German Style': L.tileLayer.provider('OpenStreetMap.DE'),
'OpenStreetMap Black and White': L.tileLayer.provider('OpenStreetMap.BlackAndWhite'),
'OpenStreetMap H.O.T.': L.tileLayer.provider('OpenStreetMap.HOT'),
'Thunderforest OpenCycleMap': L.tileLayer.provider('Thunderforest.OpenCycleMap'),
'Thunderforest Transport': L.tileLayer.provider('Thunderforest.Transport'),
'Thunderforest Landscape': L.tileLayer.provider('Thunderforest.Landscape'),
'Hydda Full': L.tileLayer.provider('Hydda.Full'),
'MapBox Example': L.tileLayer.provider('MapBox', {id: 'mapbox.streets', accessToken: 'pk.eyJ1IjoiZ3V0ZW55ZSIsImEiOiJmNjJlMDNmYTUyMzNjMzQxZmY4Mzc1ZmFiYmExNjMxOSJ9.xgl1PBwQV9CtwW-usedrcQ'}),
'Stamen Toner': L.tileLayer.provider('Stamen.Toner'),
'Stamen Terrain': L.tileLayer.provider('Stamen.Terrain'),
'Stamen Watercolor': L.tileLayer.provider('Stamen.Watercolor'),
'Jawg Streets': L.tileLayer.provider('Jawg.Streets'),
'Jawg Terrain': L.tileLayer.provider('Jawg.Terrain'),
'Esri WorldStreetMap': L.tileLayer.provider('Esri.WorldStreetMap'),
'Esri DeLorme': L.tileLayer.provider('Esri.DeLorme'),
'Esri WorldTopoMap': L.tileLayer.provider('Esri.WorldTopoMap'),
@@ -59,7 +59,12 @@
'Esri WorldPhysical': L.tileLayer.provider('Esri.WorldPhysical'),
'Esri OceanBasemap': L.tileLayer.provider('Esri.OceanBasemap'),
'Esri NatGeoWorldMap': L.tileLayer.provider('Esri.NatGeoWorldMap'),
'Esri WorldGrayCanvas': L.tileLayer.provider('Esri.WorldGrayCanvas')
'Esri WorldGrayCanvas': L.tileLayer.provider('Esri.WorldGrayCanvas'),
'Geoportail France Maps': L.tileLayer.provider('GeoportailFrance'),
'Geoportail France Orthos': L.tileLayer.provider('GeoportailFrance.orthos'),
'USGS USTopo': L.tileLayer.provider('USGS.USTopo'),
'USGS USImagery': L.tileLayer.provider('USGS.USImagery'),
'USGS USImageryTopo': L.tileLayer.provider('USGS.USImageryTopo'),
};
var overlayLayers = {
@@ -74,7 +79,14 @@
'OpenWeatherMap PressureContour': L.tileLayer.provider('OpenWeatherMap.PressureContour'),
'OpenWeatherMap Wind': L.tileLayer.provider('OpenWeatherMap.Wind'),
'OpenWeatherMap Temperature': L.tileLayer.provider('OpenWeatherMap.Temperature'),
'OpenWeatherMap Snow': L.tileLayer.provider('OpenWeatherMap.Snow')
'OpenWeatherMap Snow': L.tileLayer.provider('OpenWeatherMap.Snow'),
'Geoportail France Parcels': L.tileLayer.provider('GeoportailFrance.parcels'),
'Waymarked Trails Hiking': L.tileLayer.provider('WaymarkedTrails.hiking'),
'Waymarked Trails Cycling': L.tileLayer.provider('WaymarkedTrails.cycling'),
'Waymarked Trails MTB': L.tileLayer.provider('WaymarkedTrails.mtb'),
'Waymarked Trails Ski Slopes': L.tileLayer.provider('WaymarkedTrails.slopes'),
'Waymarked Trails Riding': L.tileLayer.provider('WaymarkedTrails.riding'),
'Waymarked Trails Skating': L.tileLayer.provider('WaymarkedTrails.skating')
};
L.control.layers(baseLayers, overlayLayers, {collapsed: false}).addTo(map);

View File

@@ -50,31 +50,13 @@
};
}
var forceHTTP = window.location.protocol === 'file:' || provider.options.forceHTTP;
if (provider.url.indexOf('//') === 0 && forceHTTP) {
provider.url = 'http:' + provider.url;
}
// If retina option is set
if (provider.options.retina) {
// Check retina screen
if (options.detectRetina && L.Browser.retina) {
// The retina option will be active now
// But we need to prevent Leaflet retina mode
options.detectRetina = false;
} else {
// No retina, remove option
provider.options.retina = '';
}
}
// replace attribution placeholders with their values from toplevel provider attribution,
// recursively
var attributionReplacer = function (attr) {
if (attr.indexOf('{attribution.') === -1) {
return attr;
}
return attr.replace(/\{attribution.(\w*)\}/,
return attr.replace(/\{attribution.(\w*)\}/g,
function (match, attributionName) {
return attributionReplacer(providers[attributionName].options.attribution);
}
@@ -95,112 +77,158 @@
L.TileLayer.Provider.providers = {
OpenStreetMap: {
url: '//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
url: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
options: {
maxZoom: 19,
attribution:
'&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
'&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
},
variants: {
Mapnik: {},
BlackAndWhite: {
url: 'http://{s}.tiles.wmflabs.org/bw-mapnik/{z}/{x}/{y}.png',
DE: {
url: 'https://{s}.tile.openstreetmap.de/tiles/osmde/{z}/{x}/{y}.png',
options: {
maxZoom: 18
}
},
DE: {
url: 'http://{s}.tile.openstreetmap.de/tiles/osmde/{z}/{x}/{y}.png',
CH: {
url: 'https://tile.osm.ch/switzerland/{z}/{x}/{y}.png',
options: {
maxZoom: 18
maxZoom: 18,
bounds: [[45, 5], [48, 11]]
}
},
France: {
url: '//{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png',
url: 'https://{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png',
options: {
maxZoom: 20,
attribution: '&copy; Openstreetmap France | {attribution.OpenStreetMap}'
attribution: '&copy; OpenStreetMap France | {attribution.OpenStreetMap}'
}
},
HOT: {
url: '//{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png',
url: 'https://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png',
options: {
attribution: '{attribution.OpenStreetMap}, Tiles courtesy of <a href="http://hot.openstreetmap.org/" target="_blank">Humanitarian OpenStreetMap Team</a>'
attribution:
'{attribution.OpenStreetMap}, ' +
'Tiles style by <a href="https://www.hotosm.org/" target="_blank">Humanitarian OpenStreetMap Team</a> ' +
'hosted by <a href="https://openstreetmap.fr/" target="_blank">OpenStreetMap France</a>'
}
},
BZH: {
url: 'https://tile.openstreetmap.bzh/br/{z}/{x}/{y}.png',
options: {
attribution: '{attribution.OpenStreetMap}, Tiles courtesy of <a href="http://www.openstreetmap.bzh/" target="_blank">Breton OpenStreetMap Team</a>',
bounds: [[46.2, -5.5], [50, 0.7]]
}
}
}
},
OpenSeaMap: {
url: 'http://tiles.openseamap.org/seamark/{z}/{x}/{y}.png',
url: 'https://tiles.openseamap.org/seamark/{z}/{x}/{y}.png',
options: {
attribution: 'Map data: &copy; <a href="http://www.openseamap.org">OpenSeaMap</a> contributors'
}
},
OPNVKarte: {
url: 'https://tileserver.memomaps.de/tilegen/{z}/{x}/{y}.png',
options: {
maxZoom: 18,
attribution: 'Map <a href="https://memomaps.de/">memomaps.de</a> <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, map data {attribution.OpenStreetMap}'
}
},
OpenTopoMap: {
url: '//{s}.tile.opentopomap.org/{z}/{x}/{y}.png',
url: 'https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png',
options: {
maxZoom: 17,
attribution: 'Map data: {attribution.OpenStreetMap}, <a href="http://viewfinderpanoramas.org">SRTM</a> | Map style: &copy; <a href="https://opentopomap.org">OpenTopoMap</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a>)'
}
},
OpenRailwayMap: {
url: 'https://{s}.tiles.openrailwaymap.org/standard/{z}/{x}/{y}.png',
options: {
maxZoom: 19,
attribution: 'Map data: {attribution.OpenStreetMap} | Map style: &copy; <a href="https://www.OpenRailwayMap.org">OpenRailwayMap</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a>)'
}
},
OpenFireMap: {
url: 'http://openfiremap.org/hytiles/{z}/{x}/{y}.png',
options: {
maxZoom: 19,
attribution: 'Map data: {attribution.OpenStreetMap} | Map style: &copy; <a href="http://www.openfiremap.org">OpenFireMap</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a>)'
}
},
SafeCast: {
url: 'https://s3.amazonaws.com/te512.safecast.org/{z}/{x}/{y}.png',
options: {
maxZoom: 16,
attribution: 'Map data: {attribution.OpenStreetMap} | Map style: &copy; <a href="https://blog.safecast.org/about/">SafeCast</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a>)'
}
},
Stadia: {
url: 'https://tiles.stadiamaps.com/tiles/alidade_smooth/{z}/{x}/{y}{r}.png',
options: {
maxZoom: 20,
attribution: '&copy; <a href="https://stadiamaps.com/">Stadia Maps</a>, &copy; <a href="https://openmaptiles.org/">OpenMapTiles</a> &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors'
},
variants: {
AlidadeSmooth: {
url: 'https://tiles.stadiamaps.com/tiles/alidade_smooth/{z}/{x}/{y}{r}.png'
},
AlidadeSmoothDark: {
url: 'https://tiles.stadiamaps.com/tiles/alidade_smooth_dark/{z}/{x}/{y}{r}.png'
},
OSMBright: {
url: 'https://tiles.stadiamaps.com/tiles/osm_bright/{z}/{x}/{y}{r}.png'
},
Outdoors: {
url: 'https://tiles.stadiamaps.com/tiles/outdoors/{z}/{x}/{y}{r}.png'
}
}
},
Thunderforest: {
url: '//{s}.tile.thunderforest.com/{variant}/{z}/{x}/{y}.png',
url: 'https://{s}.tile.thunderforest.com/{variant}/{z}/{x}/{y}.png?apikey={apikey}',
options: {
attribution:
'&copy; <a href="http://www.thunderforest.com/">Thunderforest</a>, {attribution.OpenStreetMap}',
variant: 'cycle'
variant: 'cycle',
apikey: '<insert your api key here>',
maxZoom: 22
},
variants: {
OpenCycleMap: 'cycle',
Transport: {
options: {
variant: 'transport',
maxZoom: 19
variant: 'transport'
}
},
TransportDark: {
options: {
variant: 'transport-dark',
maxZoom: 19
variant: 'transport-dark'
}
},
SpinalMap: {
options: {
variant: 'spinal-map',
maxZoom: 11
variant: 'spinal-map'
}
},
Landscape: 'landscape',
Outdoors: 'outdoors',
Pioneer: 'pioneer'
Pioneer: 'pioneer',
MobileAtlas: 'mobile-atlas',
Neighbourhood: 'neighbourhood'
}
},
OpenMapSurfer: {
url: 'http://korona.geog.uni-heidelberg.de/tiles/{variant}/x={x}&y={y}&z={z}',
CyclOSM: {
url: 'https://{s}.tile-cyclosm.openstreetmap.fr/cyclosm/{z}/{x}/{y}.png',
options: {
maxZoom: 20,
variant: 'roads',
attribution: 'Imagery from <a href="http://giscience.uni-hd.de/">GIScience Research Group @ University of Heidelberg</a> &mdash; Map data {attribution.OpenStreetMap}'
},
variants: {
Roads: 'roads',
AdminBounds: {
options: {
variant: 'adminb',
maxZoom: 19
}
},
Grayscale: {
options: {
variant: 'roadsg',
maxZoom: 19
}
}
attribution: '<a href="https://github.com/cyclosm/cyclosm-cartocss-style/releases" title="CyclOSM - Open Bicycle render">CyclOSM</a> | Map data: {attribution.OpenStreetMap}'
}
},
Hydda: {
url: '//{s}.tile.openstreetmap.se/hydda/{variant}/{z}/{x}/{y}.png',
url: 'https://{s}.tile.openstreetmap.se/hydda/{variant}/{z}/{x}/{y}.png',
options: {
maxZoom: 20,
variant: 'full',
attribution: 'Tiles courtesy of <a href="http://openstreetmap.se/" target="_blank">OpenStreetMap Sweden</a> &mdash; Map data {attribution.OpenStreetMap}'
},
@@ -210,17 +238,75 @@
RoadsAndLabels: 'roads_and_labels'
}
},
MapBox: {
url: '//api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}',
Jawg: {
url: 'https://{s}.tile.jawg.io/{variant}/{z}/{x}/{y}{r}.png?access-token={accessToken}',
options: {
attribution:
'Imagery from <a href="http://mapbox.com/about/maps/">MapBox</a> &mdash; ' +
'Map data {attribution.OpenStreetMap}',
subdomains: 'abcd'
'<a href="http://jawg.io" title="Tiles Courtesy of Jawg Maps" target="_blank">&copy; <b>Jawg</b>Maps</a> ' +
'{attribution.OpenStreetMap}',
minZoom: 0,
maxZoom: 22,
subdomains: 'abcd',
variant: 'jawg-terrain',
// Get your own Jawg access token here : https://www.jawg.io/lab/
// NB : this is a demonstration key that comes with no guarantee
accessToken: '<insert your access token here>',
},
variants: {
Streets: 'jawg-streets',
Terrain: 'jawg-terrain',
Sunny: 'jawg-sunny',
Dark: 'jawg-dark',
Light: 'jawg-light',
Matrix: 'jawg-matrix'
}
},
MapBox: {
url: 'https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}{r}?access_token={accessToken}',
options: {
attribution:
'&copy; <a href="https://www.mapbox.com/about/maps/" target="_blank">Mapbox</a> ' +
'{attribution.OpenStreetMap} ' +
'<a href="https://www.mapbox.com/map-feedback/" target="_blank">Improve this map</a>',
tileSize: 512,
maxZoom: 18,
zoomOffset: -1,
id: 'mapbox/streets-v11',
accessToken: '<insert your access token here>',
}
},
MapTiler: {
url: 'https://api.maptiler.com/maps/{variant}/{z}/{x}/{y}{r}.{ext}?key={key}',
options: {
attribution:
'<a href="https://www.maptiler.com/copyright/" target="_blank">&copy; MapTiler</a> <a href="https://www.openstreetmap.org/copyright" target="_blank">&copy; OpenStreetMap contributors</a>',
variant: 'streets',
ext: 'png',
key: '<insert your MapTiler Cloud API key here>',
tileSize: 512,
zoomOffset: -1,
minZoom: 0,
maxZoom: 21
},
variants: {
Streets: 'streets',
Basic: 'basic',
Bright: 'bright',
Pastel: 'pastel',
Positron: 'positron',
Hybrid: {
options: {
variant: 'hybrid',
ext: 'jpg'
}
},
Toner: 'toner',
Topo: 'topo',
Voyager: 'voyager'
}
},
Stamen: {
url: '//stamen-tiles-{s}.a.ssl.fastly.net/{variant}/{z}/{x}/{y}.{ext}',
url: 'https://stamen-tiles-{s}.a.ssl.fastly.net/{variant}/{z}/{x}/{y}{r}.{ext}',
options: {
attribution:
'Map tiles by <a href="http://stamen.com">Stamen Design</a>, ' +
@@ -240,8 +326,10 @@
TonerLabels: 'toner-labels',
TonerLite: 'toner-lite',
Watercolor: {
url: 'https://stamen-tiles-{s}.a.ssl.fastly.net/{variant}/{z}/{x}/{y}.{ext}',
options: {
variant: 'watercolor',
ext: 'jpg',
minZoom: 1,
maxZoom: 16
}
@@ -260,7 +348,15 @@
maxZoom: 18
}
},
TerrainLabels: {
options: {
variant: 'terrain-labels',
minZoom: 0,
maxZoom: 18
}
},
TopOSMRelief: {
url: 'https://stamen-tiles-{s}.a.ssl.fastly.net/{variant}/{z}/{x}/{y}.{ext}',
options: {
variant: 'toposm-color-relief',
ext: 'jpg',
@@ -276,8 +372,26 @@
}
}
},
TomTom: {
url: 'https://{s}.api.tomtom.com/map/1/tile/{variant}/{style}/{z}/{x}/{y}.{ext}?key={apikey}',
options: {
variant: 'basic',
maxZoom: 22,
attribution:
'<a href="https://tomtom.com" target="_blank">&copy; 1992 - ' + new Date().getFullYear() + ' TomTom.</a> ',
subdomains: 'abcd',
style: 'main',
ext: 'png',
apikey: '<insert your API key here>',
},
variants: {
Basic: 'basic',
Hybrid: 'hybrid',
Labels: 'labels'
}
},
Esri: {
url: '//server.arcgisonline.com/ArcGIS/rest/services/{variant}/MapServer/tile/{z}/{y}/{x}',
url: 'https://server.arcgisonline.com/ArcGIS/rest/services/{variant}/MapServer/tile/{z}/{y}/{x}',
options: {
variant: 'World_Street_Map',
attribution: 'Tiles &copy; Esri'
@@ -361,10 +475,11 @@
}
},
OpenWeatherMap: {
url: 'http://{s}.tile.openweathermap.org/map/{variant}/{z}/{x}/{y}.png',
url: 'http://{s}.tile.openweathermap.org/map/{variant}/{z}/{x}/{y}.png?appid={apiKey}',
options: {
maxZoom: 19,
attribution: 'Map data &copy; <a href="http://openweathermap.org">OpenWeatherMap</a>',
apiKey: '<insert your api key here>',
opacity: 0.5
},
variants: {
@@ -384,20 +499,16 @@
HERE: {
/*
* HERE maps, formerly Nokia maps.
* These basemaps are free, but you need an API key. Please sign up at
* http://developer.here.com/getting-started
*
* Note that the base urls contain '.cit' whichs is HERE's
* 'Customer Integration Testing' environment. Please remove for production
* envirionments.
* These basemaps are free, but you need an api id and app key. Please sign up at
* https://developer.here.com/plans
*/
url:
'//{s}.{base}.maps.cit.api.here.com/maptile/2.1/' +
'https://{s}.{base}.maps.api.here.com/maptile/2.1/' +
'{type}/{mapID}/{variant}/{z}/{x}/{y}/{size}/{format}?' +
'app_id={app_id}&app_code={app_code}&lg={language}',
options: {
attribution:
'Map &copy; 1987-2014 <a href="http://developer.here.com">HERE</a>',
'Map &copy; 1987-' + new Date().getFullYear() + ' <a href="http://developer.here.com">HERE</a>',
subdomains: '1234',
mapID: 'newest',
'app_id': '<insert your app_id here>',
@@ -418,11 +529,21 @@
normalDayGreyMobile: 'normal.day.grey.mobile',
normalDayTransit: 'normal.day.transit',
normalDayTransitMobile: 'normal.day.transit.mobile',
normalDayTraffic: {
options: {
variant: 'normal.traffic.day',
base: 'traffic',
type: 'traffictile'
}
},
normalNight: 'normal.night',
normalNightMobile: 'normal.night.mobile',
normalNightGrey: 'normal.night.grey',
normalNightGreyMobile: 'normal.night.grey.mobile',
normalNightTransit: 'normal.night.transit',
normalNightTransitMobile: 'normal.night.transit.mobile',
reducedDay: 'reduced.day',
reducedNight: 'reduced.night',
basicMap: {
options: {
type: 'basetile'
@@ -453,6 +574,133 @@
variant: 'hybrid.day.mobile'
}
},
hybridDayTransit: {
options: {
base: 'aerial',
variant: 'hybrid.day.transit'
}
},
hybridDayGrey: {
options: {
base: 'aerial',
variant: 'hybrid.grey.day'
}
},
hybridDayTraffic: {
options: {
variant: 'hybrid.traffic.day',
base: 'traffic',
type: 'traffictile'
}
},
pedestrianDay: 'pedestrian.day',
pedestrianNight: 'pedestrian.night',
satelliteDay: {
options: {
base: 'aerial',
variant: 'satellite.day'
}
},
terrainDay: {
options: {
base: 'aerial',
variant: 'terrain.day'
}
},
terrainDayMobile: {
options: {
base: 'aerial',
variant: 'terrain.day.mobile'
}
}
}
},
HEREv3: {
/*
* HERE maps API Version 3.
* These basemaps are free, but you need an API key. Please sign up at
* https://developer.here.com/plans
* Version 3 deprecates the app_id and app_code access in favor of apiKey
*
* Supported access methods as of 2019/12/21:
* @see https://developer.here.com/faqs#access-control-1--how-do-you-control-access-to-here-location-services
*/
url:
'https://{s}.{base}.maps.ls.hereapi.com/maptile/2.1/' +
'{type}/{mapID}/{variant}/{z}/{x}/{y}/{size}/{format}?' +
'apiKey={apiKey}&lg={language}',
options: {
attribution:
'Map &copy; 1987-' + new Date().getFullYear() + ' <a href="http://developer.here.com">HERE</a>',
subdomains: '1234',
mapID: 'newest',
apiKey: '<insert your apiKey here>',
base: 'base',
variant: 'normal.day',
maxZoom: 20,
type: 'maptile',
language: 'eng',
format: 'png8',
size: '256'
},
variants: {
normalDay: 'normal.day',
normalDayCustom: 'normal.day.custom',
normalDayGrey: 'normal.day.grey',
normalDayMobile: 'normal.day.mobile',
normalDayGreyMobile: 'normal.day.grey.mobile',
normalDayTransit: 'normal.day.transit',
normalDayTransitMobile: 'normal.day.transit.mobile',
normalNight: 'normal.night',
normalNightMobile: 'normal.night.mobile',
normalNightGrey: 'normal.night.grey',
normalNightGreyMobile: 'normal.night.grey.mobile',
normalNightTransit: 'normal.night.transit',
normalNightTransitMobile: 'normal.night.transit.mobile',
reducedDay: 'reduced.day',
reducedNight: 'reduced.night',
basicMap: {
options: {
type: 'basetile'
}
},
mapLabels: {
options: {
type: 'labeltile',
format: 'png'
}
},
trafficFlow: {
options: {
base: 'traffic',
type: 'flowtile'
}
},
carnavDayGrey: 'carnav.day.grey',
hybridDay: {
options: {
base: 'aerial',
variant: 'hybrid.day'
}
},
hybridDayMobile: {
options: {
base: 'aerial',
variant: 'hybrid.day.mobile'
}
},
hybridDayTransit: {
options: {
base: 'aerial',
variant: 'hybrid.day.transit'
}
},
hybridDayGrey: {
options: {
base: 'aerial',
variant: 'hybrid.grey.day'
}
},
pedestrianDay: 'pedestrian.day',
pedestrianNight: 'pedestrian.night',
satelliteDay: {
@@ -476,11 +724,11 @@
}
},
FreeMapSK: {
url: 'http://t{s}.freemap.sk/T/{z}/{x}/{y}.jpeg',
url: 'https://{s}.freemap.sk/T/{z}/{x}/{y}.jpeg',
options: {
minZoom: 8,
maxZoom: 16,
subdomains: '1234',
subdomains: 'abcd',
bounds: [[47.204642, 15.996093], [49.830896, 22.576904]],
attribution:
'{attribution.OpenStreetMap}, vizualization CC-By-SA 2.0 <a href="http://freemap.sk">Freemap.sk</a>'
@@ -494,11 +742,11 @@
}
},
CartoDB: {
url: 'http://{s}.basemaps.cartocdn.com/{variant}/{z}/{x}/{y}.png',
url: 'https://{s}.basemaps.cartocdn.com/{variant}/{z}/{x}/{y}{r}.png',
options: {
attribution: '{attribution.OpenStreetMap} &copy; <a href="http://cartodb.com/attributions">CartoDB</a>',
attribution: '{attribution.OpenStreetMap} &copy; <a href="https://carto.com/attributions">CARTO</a>',
subdomains: 'abcd',
maxZoom: 19,
maxZoom: 20,
variant: 'light_all'
},
variants: {
@@ -507,11 +755,15 @@
PositronOnlyLabels: 'light_only_labels',
DarkMatter: 'dark_all',
DarkMatterNoLabels: 'dark_nolabels',
DarkMatterOnlyLabels: 'dark_only_labels'
DarkMatterOnlyLabels: 'dark_only_labels',
Voyager: 'rastertiles/voyager',
VoyagerNoLabels: 'rastertiles/voyager_nolabels',
VoyagerOnlyLabels: 'rastertiles/voyager_only_labels',
VoyagerLabelsUnder: 'rastertiles/voyager_labels_under'
}
},
HikeBike: {
url: 'http://{s}.tiles.wmflabs.org/{variant}/{z}/{x}/{y}.png',
url: 'https://tiles.wmflabs.org/{variant}/{z}/{x}/{y}.png',
options: {
maxZoom: 19,
attribution: '{attribution.OpenStreetMap}',
@@ -528,19 +780,39 @@
}
},
BasemapAT: {
url: '//maps{s}.wien.gv.at/basemap/{variant}/normal/google3857/{z}/{y}/{x}.{format}',
url: 'https://maps{s}.wien.gv.at/basemap/{variant}/{type}/google3857/{z}/{y}/{x}.{format}',
options: {
maxZoom: 19,
attribution: 'Datenquelle: <a href="www.basemap.at">basemap.at</a>',
attribution: 'Datenquelle: <a href="https://www.basemap.at">basemap.at</a>',
subdomains: ['', '1', '2', '3', '4'],
type: 'normal',
format: 'png',
bounds: [[46.358770, 8.782379], [49.037872, 17.189532]],
variant: 'geolandbasemap'
},
variants: {
basemap: 'geolandbasemap',
basemap: {
options: {
maxZoom: 20, // currently only in Vienna
variant: 'geolandbasemap'
}
},
grau: 'bmapgrau',
overlay: 'bmapoverlay',
terrain: {
options: {
variant: 'bmapgelaende',
type: 'grau',
format: 'jpeg'
}
},
surface: {
options: {
variant: 'bmapoberflaeche',
type: 'grau',
format: 'jpeg'
}
},
highdpi: {
options: {
variant: 'bmaphidpi',
@@ -549,14 +821,32 @@
},
orthofoto: {
options: {
maxZoom: 20, // currently only in Vienna
variant: 'bmaporthofoto30cm',
format: 'jpeg'
}
}
}
},
nlmaps: {
url: 'https://geodata.nationaalgeoregister.nl/tiles/service/wmts/{variant}/EPSG:3857/{z}/{x}/{y}.png',
options: {
minZoom: 6,
maxZoom: 19,
bounds: [[50.5, 3.25], [54, 7.6]],
attribution: 'Kaartgegevens &copy; <a href="https://www.kadaster.nl">Kadaster</a>'
},
variants: {
'standaard': 'brtachtergrondkaart',
'pastel': 'brtachtergrondkaartpastel',
'grijs': 'brtachtergrondkaartgrijs',
'luchtfoto': {
'url': 'https://service.pdok.nl/hwh/luchtfotorgb/wmts/v1_0/Actueel_ortho25/EPSG:3857/{z}/{x}/{y}.jpeg',
}
}
},
NASAGIBS: {
url: '//map1.vis.earthdata.nasa.gov/wmts-webmerc/{variant}/default/{time}/{tilematrixset}{maxZoom}/{z}/{y}/{x}.{format}',
url: 'https://map1.vis.earthdata.nasa.gov/wmts-webmerc/{variant}/default/{time}/{tilematrixset}{maxZoom}/{z}/{y}/{x}.{format}',
options: {
attribution:
'Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System ' +
@@ -587,7 +877,7 @@
},
ModisTerraSnowCover: {
options: {
variant: 'MODIS_Terra_Snow_Cover',
variant: 'MODIS_Terra_NDSI_Snow_Cover',
format: 'png',
maxZoom: 8,
opacity: 0.75
@@ -620,7 +910,7 @@
// z0-9 - 1:1m
// z10-11 - quarter inch (1:253440)
// z12-18 - one inch (1:63360)
url: '//nls-{s}.tileserver.com/nls/{z}/{x}/{y}.jpg',
url: 'https://nls-{s}.tileserver.com/nls/{z}/{x}/{y}.jpg',
options: {
attribution: '<a href="http://geo.nls.uk/maps/">National Library of Scotland Historic Maps</a>',
bounds: [[49.6, -12], [61.7, 3]],
@@ -628,6 +918,177 @@
maxZoom: 18,
subdomains: '0123',
}
},
JusticeMap: {
// Justice Map (http://www.justicemap.org/)
// Visualize race and income data for your community, county and country.
// Includes tools for data journalists, bloggers and community activists.
url: 'https://www.justicemap.org/tile/{size}/{variant}/{z}/{x}/{y}.png',
options: {
attribution: '<a href="http://www.justicemap.org/terms.php">Justice Map</a>',
// one of 'county', 'tract', 'block'
size: 'county',
// Bounds for USA, including Alaska and Hawaii
bounds: [[14, -180], [72, -56]]
},
variants: {
income: 'income',
americanIndian: 'indian',
asian: 'asian',
black: 'black',
hispanic: 'hispanic',
multi: 'multi',
nonWhite: 'nonwhite',
white: 'white',
plurality: 'plural'
}
},
GeoportailFrance: {
url: 'https://wxs.ign.fr/{apikey}/geoportail/wmts?REQUEST=GetTile&SERVICE=WMTS&VERSION=1.0.0&STYLE={style}&TILEMATRIXSET=PM&FORMAT={format}&LAYER={variant}&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}',
options: {
attribution: '<a target="_blank" href="https://www.geoportail.gouv.fr/">Geoportail France</a>',
bounds: [[-75, -180], [81, 180]],
minZoom: 2,
maxZoom: 18,
// Get your own geoportail apikey here : http://professionnels.ign.fr/ign/contrats/
// NB : 'choisirgeoportail' is a demonstration key that comes with no guarantee
apikey: 'choisirgeoportail',
format: 'image/png',
style: 'normal',
variant: 'GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2'
},
variants: {
plan: 'GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2',
parcels: {
options: {
variant: 'CADASTRALPARCELS.PARCELLAIRE_EXPRESS',
style: 'PCI vecteur',
maxZoom: 20
}
},
orthos: {
options: {
maxZoom: 19,
format: 'image/jpeg',
variant: 'ORTHOIMAGERY.ORTHOPHOTOS'
}
}
}
},
OneMapSG: {
url: 'https://maps-{s}.onemap.sg/v3/{variant}/{z}/{x}/{y}.png',
options: {
variant: 'Default',
minZoom: 11,
maxZoom: 18,
bounds: [[1.56073, 104.11475], [1.16, 103.502]],
attribution: '<img src="https://docs.onemap.sg/maps/images/oneMap64-01.png" style="height:20px;width:20px;"/> New OneMap | Map data &copy; contributors, <a href="http://SLA.gov.sg">Singapore Land Authority</a>'
},
variants: {
Default: 'Default',
Night: 'Night',
Original: 'Original',
Grey: 'Grey',
LandLot: 'LandLot'
}
},
USGS: {
url: 'https://basemap.nationalmap.gov/arcgis/rest/services/USGSTopo/MapServer/tile/{z}/{y}/{x}',
options: {
maxZoom: 20,
attribution: 'Tiles courtesy of the <a href="https://usgs.gov/">U.S. Geological Survey</a>'
},
variants: {
USTopo: {},
USImagery: {
url: 'https://basemap.nationalmap.gov/arcgis/rest/services/USGSImageryOnly/MapServer/tile/{z}/{y}/{x}'
},
USImageryTopo: {
url: 'https://basemap.nationalmap.gov/arcgis/rest/services/USGSImageryTopo/MapServer/tile/{z}/{y}/{x}'
}
}
},
WaymarkedTrails: {
url: 'https://tile.waymarkedtrails.org/{variant}/{z}/{x}/{y}.png',
options: {
maxZoom: 18,
attribution: 'Map data: {attribution.OpenStreetMap} | Map style: &copy; <a href="https://waymarkedtrails.org">waymarkedtrails.org</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a>)'
},
variants: {
hiking: 'hiking',
cycling: 'cycling',
mtb: 'mtb',
slopes: 'slopes',
riding: 'riding',
skating: 'skating'
}
},
OpenAIP: {
url: 'https://{s}.tile.maps.openaip.net/geowebcache/service/tms/1.0.0/openaip_basemap@EPSG%3A900913@png/{z}/{x}/{y}.{ext}',
options: {
attribution: '<a href="https://www.openaip.net/">openAIP Data</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-NC-SA</a>)',
ext: 'png',
minZoom: 4,
maxZoom: 14,
tms: true,
detectRetina: true,
subdomains: '12'
}
},
OpenSnowMap: {
url: 'https://tiles.opensnowmap.org/{variant}/{z}/{x}/{y}.png',
options: {
minZoom: 9,
maxZoom: 18,
attribution: 'Map data: {attribution.OpenStreetMap} & ODbL, &copy; <a href="https://www.opensnowmap.org/iframes/data.html">www.opensnowmap.org</a> <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>'
},
variants: {
pistes: 'pistes',
}
},
AzureMaps: {
url:
'https://atlas.microsoft.com/map/tile?api-version={apiVersion}'+
'&tilesetId={variant}&x={x}&y={y}&zoom={z}&language={language}'+
'&subscription-key={subscriptionKey}',
options: {
attribution: 'See https://docs.microsoft.com/en-US/rest/api/maps/renderv2/getmaptilepreview for details.',
apiVersion: '2.0',
variant: 'microsoft.imagery',
subscriptionKey: '<insert your subscription key here>',
language: 'en-US',
},
variants: {
MicrosoftImagery: 'microsoft.imagery',
MicrosoftBaseDarkGrey: 'microsoft.base.darkgrey',
MicrosoftBaseRoad: 'microsoft.base.road',
MicrosoftBaseHybridRoad: 'microsoft.base.hybrid.road',
MicrosoftTerraMain: 'microsoft.terra.main',
MicrosoftWeatherInfraredMain: {
url:
'https://atlas.microsoft.com/map/tile?api-version={apiVersion}'+
'&tilesetId={variant}&x={x}&y={y}&zoom={z}'+
'&timeStamp={timeStamp}&language={language}' +
'&subscription-key={subscriptionKey}',
options: {
timeStamp: '2021-05-08T09:03:00Z',
attribution: 'See https://docs.microsoft.com/en-US/rest/api/maps/renderv2/getmaptilepreview#uri-parameters for details.',
variant: 'microsoft.weather.infrared.main',
},
},
MicrosoftWeatherRadarMain: {
url:
'https://atlas.microsoft.com/map/tile?api-version={apiVersion}'+
'&tilesetId={variant}&x={x}&y={y}&zoom={z}'+
'&timeStamp={timeStamp}&language={language}' +
'&subscription-key={subscriptionKey}',
options: {
timeStamp: '2021-05-08T09:03:00Z',
attribution: 'See https://docs.microsoft.com/en-US/rest/api/maps/renderv2/getmaptilepreview#uri-parameters for details.',
variant: 'microsoft.weather.radar.main',
},
}
},
}
};

File diff suppressed because one or more lines are too long

View File

@@ -1,45 +1,45 @@
{
"name": "leaflet-providers",
"version": "1.1.15",
"description": "An extension to Leaflet that contains configurations for various free tile providers.",
"main": "leaflet-providers.js",
"repository": {
"type": "git",
"url": "git://github.com/leaflet-extras/leaflet-providers.git"
},
"scripts": {
"test": "npm run lint && npm run testsuite",
"testsuite": "mocha-phantomjs tests/index.html",
"lint": "eslint --config .eslintrc leaflet-providers.js index.html preview/*.js preview/*.html tests/*",
"min": "uglifyjs leaflet-providers.js -mc -o leaflet-providers.min.js",
"release": "mversion patch -m"
},
"license": "BSD-2-Clause",
"bugs": {
"url": "https://github.com/leaflet-extras/leaflet-providers/issues"
},
"files": [
"leaflet-providers.js",
"README.md",
"CHANGELOG.md",
"licence.md"
],
"devDependencies": {
"chai": "^2.3.0",
"eslint": "^2.7.0",
"eslint-plugin-html": "^1.4.0",
"mocha": "^2.2.4",
"mocha-phantomjs": "^3.5.3",
"mversion": "^1.3.0",
"phantomjs": "1.9.7-15",
"uglify-js": "^2.4.15"
},
"autoupdate": {
"source": "git",
"target": "git://github.com/leaflet-extras/leaflet-providers.git",
"basePath": "/",
"name": "leaflet-providers",
"version": "1.13.0",
"description": "An extension to Leaflet that contains configurations for various free tile providers.",
"main": "leaflet-providers.js",
"repository": {
"type": "git",
"url": "git://github.com/leaflet-extras/leaflet-providers.git"
},
"scripts": {
"test": "npm run lint && npm run testsuite",
"testsuite": "mocha-chrome tests/index.html",
"lint": "eslint --config .eslintrc leaflet-providers.js index.html preview/*.js preview/*.html tests/*",
"min": "uglifyjs leaflet-providers.js -mc -o leaflet-providers.min.js",
"release-patch": "mversion patch -m",
"release-minor": "mversion minor -m"
},
"license": "BSD-2-Clause",
"bugs": {
"url": "https://github.com/leaflet-extras/leaflet-providers/issues"
},
"files": [
"leaflet-providers.js"
]
}
}
"leaflet-providers.js",
"README.md",
"CHANGELOG.md",
"licence.md"
],
"devDependencies": {
"chai": "^4.3.4",
"eslint": "^8.0.0",
"eslint-plugin-html": "^6.1.2",
"mocha": "^9.0.3",
"mocha-chrome": "^2.2.0",
"mversion": "^2.0.1",
"uglify-js": "^3.14.1"
},
"autoupdate": {
"source": "git",
"target": "git://github.com/leaflet-extras/leaflet-providers.git",
"basePath": "/",
"files": [
"leaflet-providers.js"
]
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -5,8 +5,8 @@
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-tile-container,
.leaflet-map-pane svg,
.leaflet-map-pane canvas,
.leaflet-pane > svg,
.leaflet-pane > canvas,
.leaflet-zoom-box,
.leaflet-image-layer,
.leaflet-layer {
@@ -25,6 +25,10 @@
user-select: none;
-webkit-user-drag: none;
}
/* Prevents IE11 from highlighting tiles in blue */
.leaflet-tile::selection {
background: transparent;
}
/* Safari renders non-retina tile on retina better with this, but Chrome is worse */
.leaflet-safari .leaflet-tile {
image-rendering: -webkit-optimize-contrast;
@@ -43,9 +47,12 @@
/* .leaflet-container img: map is broken in FF if you have max-width: 100% on tiles */
.leaflet-container .leaflet-overlay-pane svg,
.leaflet-container .leaflet-marker-pane img,
.leaflet-container .leaflet-shadow-pane img,
.leaflet-container .leaflet-tile-pane img,
.leaflet-container img.leaflet-image-layer {
.leaflet-container img.leaflet-image-layer,
.leaflet-container .leaflet-tile {
max-width: none !important;
max-height: none !important;
}
.leaflet-container.leaflet-touch-zoom {
@@ -54,11 +61,20 @@
}
.leaflet-container.leaflet-touch-drag {
-ms-touch-action: pinch-zoom;
}
.leaflet-container.leaflet-touch-drag.leaflet-touch-drag {
/* Fallback for FF which doesn't support pinch-zoom */
touch-action: none;
touch-action: pinch-zoom;
}
.leaflet-container.leaflet-touch-drag.leaflet-touch-zoom {
-ms-touch-action: none;
touch-action: none;
}
.leaflet-container {
-webkit-tap-highlight-color: transparent;
}
.leaflet-container a {
-webkit-tap-highlight-color: rgba(51, 181, 229, 0.4);
}
.leaflet-tile {
filter: inherit;
visibility: hidden;
@@ -157,7 +173,6 @@
opacity: 0;
-webkit-transition: opacity 0.2s linear;
-moz-transition: opacity 0.2s linear;
-o-transition: opacity 0.2s linear;
transition: opacity 0.2s linear;
}
.leaflet-fade-anim .leaflet-map-pane .leaflet-popup {
@@ -174,14 +189,12 @@
.leaflet-zoom-anim .leaflet-zoom-animated {
-webkit-transition: -webkit-transform 0.25s cubic-bezier(0,0,0.25,1);
-moz-transition: -moz-transform 0.25s cubic-bezier(0,0,0.25,1);
-o-transition: -o-transform 0.25s cubic-bezier(0,0,0.25,1);
transition: transform 0.25s cubic-bezier(0,0,0.25,1);
}
.leaflet-zoom-anim .leaflet-tile,
.leaflet-pan-anim .leaflet-tile {
-webkit-transition: none;
-moz-transition: none;
-o-transition: none;
transition: none;
}
@@ -198,6 +211,7 @@
.leaflet-grab {
cursor: -webkit-grab;
cursor: -moz-grab;
cursor: grab;
}
.leaflet-crosshair,
.leaflet-crosshair .leaflet-interactive {
@@ -213,6 +227,7 @@
cursor: move;
cursor: -webkit-grabbing;
cursor: -moz-grabbing;
cursor: grabbing;
}
/* marker & overlays interactivity */
@@ -226,7 +241,8 @@
.leaflet-marker-icon.leaflet-interactive,
.leaflet-image-layer.leaflet-interactive,
.leaflet-pane > svg path.leaflet-interactive {
.leaflet-pane > svg path.leaflet-interactive,
svg.leaflet-image-layer.leaflet-interactive path {
pointer-events: visiblePainted; /* IE 9-10 doesn't have auto */
pointer-events: auto;
}
@@ -302,7 +318,14 @@
height: 30px;
line-height: 30px;
}
.leaflet-touch .leaflet-bar a:first-child {
border-top-left-radius: 2px;
border-top-right-radius: 2px;
}
.leaflet-touch .leaflet-bar a:last-child {
border-bottom-left-radius: 2px;
border-bottom-right-radius: 2px;
}
/* zoom control */
@@ -311,16 +334,10 @@
font: bold 18px 'Lucida Console', Monaco, monospace;
text-indent: 1px;
}
.leaflet-control-zoom-out {
font-size: 20px;
}
.leaflet-touch .leaflet-control-zoom-in {
.leaflet-touch .leaflet-control-zoom-in, .leaflet-touch .leaflet-control-zoom-out {
font-size: 22px;
}
.leaflet-touch .leaflet-control-zoom-out {
font-size: 24px;
}
/* layers control */
@@ -358,6 +375,7 @@
}
.leaflet-control-layers-scrollbar {
overflow-y: scroll;
overflow-x: hidden;
padding-right: 5px;
}
.leaflet-control-layers-selector {
@@ -481,7 +499,6 @@
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-ms-transform: rotate(45deg);
-o-transform: rotate(45deg);
transform: rotate(45deg);
}
.leaflet-popup-content-wrapper,
@@ -515,7 +532,7 @@
}
.leaflet-oldie .leaflet-popup-content-wrapper {
zoom: 1;
-ms-zoom: 1;
}
.leaflet-oldie .leaflet-popup-tip {
width: 24px;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,13 @@
sudo: false
language: node_js
node_js:
- "iojs"
- "4.1"
- "4.0"
- "0.12"
- "0.10"
# whitelist
branches:
only:
- gh-pages
- /.*/

View File

@@ -0,0 +1,117 @@
2.2.12
------
backported from 3.0.0-dev: de-namespace full geometry content in output (internal state leak)
2.2.11
------
revert "use strict" because of some issues on older (0.…) nodejs
2.2.10
------
* fix another undeclared variable breaking the module in strict mode
* enable "use strict";
2.2.9
-----
split off polygon detection data: https://github.com/tyrasd/osm-polygon-features
2.2.8
-----
fix variable leaking into global scope
2.2.7
-----
fix a bug where loading certain complex `out geom` content resulted in invalid polygon geometries
2.2.6
-----
add bower support #45
2.2.5
-----
add `-m` parameter that minifies output json
2.2.4
-----
fixed a bug where full geometry information caused additional Point features in the output
2.2.3
-----
* updates to polygon detection: natural=cliff is not automatically an area, golf=* is rendered as polygons
* speed optimizations for xml input in CLI mode #34
2.2.1
-----
* fix bug with ref-less, clipped full geometry ways in JSON mode
2.2.0
-----
* support for Overpass API "full" geometry
2.1.0
-----
* implemented support for Overpass API geometry types "center" and "bounds"
* new command line option `-n` to make properties numeric
* added verbose option/mode that displays some debug info to the console/stderr
2.0.5
-----
* support input files larger than 256 MB. #17
2.0.4
-----
* fix unresolved xml entities in command line mode
2.0.2
-----
* fix a dangling dependency (which led fresh installations to crash prematurely)
2.0.0
-----
* simpler API (module exports as a plain function), old `.toGeojson` still available as a fallback
* output (multi)polygons with consistent winding orders
* improve handling of simple multipolygons
* use browserify for browser library (comes bundeled with dependencies)
* some minor speed improvements
1.4.0
-----
* fix various speed bottlenecks (xml parsing, geojson construction, …)
* better performance when handling large xml files with the cli tool: ![](https://f.cloud.github.com/assets/1927298/1461813/4a1ce53e-44ce-11e3-9a96-d600eb3aba9b.png)
1.3.1
-----
* add --help and --version parameters to cli tool
* fix bug with not automatically detected file formats in pipe mode (cli tool)
1.3.0
-----
* more versatile cli tool (can read osm json, optionally enhanced output)
* many more unit tests
* fixed bugs with some partially incomplete data
1.2.1
-----
* fix wrong (inverse) logic in uninterestingTags callback evaluation (backported from master)
1.2.0
-----
* add [demo](http://tyrasd.github.io/osmtogeojson/) page
* support for pipes in cli tool: `echo '<osm><node lat="1.23" lon="3.21" id="-1" /></osm>' | osmtogeojson`
* add flat-properties output mode (default for the cli tool)
* add options to override default `uninterestingTags` and `polygonFeatures`
* better documentation
* more test cases
* further improvements in polygon feature detection
1.1.1
-----
* bugfix: remove unneeded debugging code
1.1.0
-----
* command line tool added
1.0.0
-----
* initial release

View File

@@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright (c) 2013 Martin Raifer
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,6 @@
osmtogeojson.js: index.js package.json lodash.custom.js node_modules
browserify -s osmtogeojson index.js | uglifyjs -c -m -o osmtogeojson.js
coverage: .
istanbul cover _mocha -x lodash.custom.js -- -R spec
lodash: .
lodash exports=node include=clone,merge,isEmpty,isArray,compact,each -d

View File

@@ -0,0 +1,89 @@
osmtogeojson
============
Converts [OSM](http://openstreetmap.org) [data](http://wiki.openstreetmap.org/wiki/OSM_XML) to [GeoJSON](http://www.geojson.org/). Try the [demo](http://tyrasd.github.io/osmtogeojson/)!
* stable
* real OSM [polygon detection](https://wiki.openstreetmap.org/wiki/Overpass_turbo/Polygon_Features)
* proper OSM multipolygon support
* full support for extended Overpass API [geometry modes](http://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL#Print_.28out.29)
* well [tested](https://github.com/tyrasd/osmtogeojson/tree/gh-pages/test/) and proven
* fast
This code is used in and maintained by the [overpass turbo](http://github.com/tyrasd/overpass-ide) project.
[![Build Status](https://secure.travis-ci.org/tyrasd/osmtogeojson.png)](https://travis-ci.org/tyrasd/osmtogeojson)
Usage
-----
### command line tool
Installation:
$ npm install -g osmtogeojson
Usage:
$ osmtogeojson file.osm > file.geojson
Supported command line options are shown with:
$ osmtogeojson --help
When working with extra large data files (≳ 100 MB) it is recommended to run the programm with a little extra memory to avoid *process out of memory* errors. The easiest way to do this is by running the command as `node <path-to-osmtogeojson>` and setting the `--max_old_space_size=…` parameter to the available memory size in MB (osmtogeojson typically needs about 4-5 times the input data size):
$ node --max_old_space_size=8192 `which osmtogeojson` large.osm > large.geojson
### nodejs library
Installation:
$ npm install osmtogeojson
Usage:
var osmtogeojson = require('osmtogeojson');
osmtogeojson(osm_data);
### browser library
<script src='osmtogeojson.js'></script>
osmtogeojson(osm_data);
API
---
### `osmtogeojson( data, options )`
Converts OSM data into GeoJSON.
* `data`: the OSM data. Either as a XML DOM or in [OSM JSON](http://overpass-api.de/output_formats.html#json).
* `options`: optional. The following options can be used:
* `flatProperties`: If true, the resulting GeoJSON feature's properties will be a simple key-value list instead of a structured json object (with separate tags and metadata). default: false
* `uninterestingTags`: Either a [blacklist](https://github.com/tyrasd/osmtogeojson/blob/2.0.0/index.js#L14-L24) of tag keys or a callback function. Will be used to decide if a feature is *interesting* enough for its own GeoJSON feature.
* `polygonFeatures`: Either a [json object](https://github.com/tyrasd/osmtogeojson/blob/2.0.0/polygon_features.json) or callback function that is used to determine if a closed way should be treated as a Polygon or LineString. [read more](https://wiki.openstreetmap.org/wiki/Overpass_turbo/Polygon_Features)
The result is a javascript object of GeoJSON data:
GeoJSON
-------
The GeoJSON produced by this library will include exactly one GeoJSON-feature for each of the following OSM objects (that is everything that is also visible in overpass turbo's map view):
* all unconnected or [*interesting*](#api) tagged nodes (POIs)
* all ways (except [*uninteresting*](#api) multipolygon outlines)
* all multipolygons (simple multipolygons with exactly one closed outer way are present via their outer way)
All data is given as a FeatureCollection. Each Feature in the collection has an `id` property that is formed from the type and id of the original OSM object (e.g. `node/123`) and has the member `properties` containing the following data:
* `type`: the OSM data type
* `id`: the OSM id
* `tags`: a collection of all tags
* `meta`: metainformaton about the feature (e.g. version, timestamp, user, etc.)
* `relations`: an array of relations the feature is member of. Each relation is encoded as an object literal containing the following properties: `role` (membership role), `rel` (the relation's id) and `reltags` (contains all tags of the relation)
* `tainted`: this flag is set when the feature's geometry is incomplete (e.g. missing nodes of a way or missing ways of a multipolygon)
If the [option](#api) `flatProperties` is set to true, the `properties` object will not contain any nested object literals, but directly provide a concise id, meta data and the tags of the respective OSM object.

View File

@@ -0,0 +1,26 @@
{
"name": "osmtogeojson",
"main": "osmtogeojson.js",
"version": "2.2.12",
"homepage": "http://tyrasd.github.io/osmtogeojson",
"authors": [
"Martin Raifer"
],
"description": "convert OSM to geojson",
"moduleType": [
"node"
],
"keywords": [
"OSM",
"geoJSON",
"GIS"
],
"license": "MIT",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
]
}

View File

@@ -0,0 +1,202 @@
<!--
demo page / introduction for osmtogeojson
https://tyrasd.github.io/osmtogeojson
https://github.com/tyrasd/osmtogeojson
this page is based on https://github.com/aaronlidman/osm-and-geojson (c)Aaron Lidman, WTFPL
-->
<html>
<head>
<title>osmtogeojson</title>
<script type="text/javascript" src="//code.jquery.com/jquery-1.10.1.min.js"></script>
<script type="text/javascript" src="osmtogeojson.js"></script>
<script type="text/javascript">
function toGeo(e) {
e.preventDefault();
var data = document.getElementById('osmxml').value || "<osm></osm>",
geojson;
try {
data = $.parseXML(data);
} catch(e) {
data = JSON.parse(data);
}
geojson = osmtogeojson(data);
document.getElementById('geojson').value = JSON.stringify(geojson, null, 4);
console.log(geojson);
}
$(function() {
$("#toGeo").click(toGeo);
});
</script>
<style type="text/css">
body {
font-size: 18px;
background: white;
font-family: "Helvetica Neue", Helvetica, sans-serif;
width: 960px;
margin: 50px auto;
color: #222;
line-height: 1.7em
}
a { color: black; }
li {
line-height: 1.7em;
text-align: left;
list-style: none;
}
textarea, input { outline: none; }
#left {
width: 49%;
float: left;
text-align: center;
}
#osmxml, #geojson {
width: 100%;
background: white;
border: 1px solid #ccc;
height: 320px;
overflow: auto;
margin-bottom: 20px;
}
#right {
width: 49%;
float: right;
text-align: center;
}
.button {
display: inline-block;
text-shadow: 0px 0px 1px black;
border-radius: 3px;
color: white;
background: #A33;
padding: 10px 15px;
font-weight: bold;
text-decoration: none;
}
.button:hover {
background: #833;
}
.button:active {
box-shadow: inset 0 0 10px rgba(0,0,0,0.75);
}
textarea {
font-size: 13px;
line-height: 1.5em;
padding: 7px 10px;
}
#top {
font-size: 22px;
text-align: center;
margin-bottom: 25px;
}
#name {
font-size: 44px;
letter-spacing: -1px;
font-weight: bold;
margin-right: 5px;
}
#example {
clear: both;
width: 100%;
height: 500px;
text-align: center;
}
#about {
width: 720px;
margin: 0 auto;
}
#download {
margin: 50px auto 0 auto;
text-align: center;
}
#dl {
background: #569834;
padding: 7px 10px;
border-radius: 3px;
color: white;
font-weight: bold;
font-size: 32px;
}
.disc { list-style: disc; }
</style>
</head>
<body>
<a href="https://github.com/tyrasd/osmtogeojson"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png" alt="Fork me on GitHub"></a>
<div id="top">
<span id="name">osmtogeojson</span> converts OSM data to GeoJSON.
</div>
<div id="example">
<div id="left">
<h3>OSM data</h3>
<textarea id="osmxml" contenteditable="true"></textarea>
</div>
<div id="right">
<h3>GeoJSON</h3>
<textarea id="geojson" contenteditable="true"></textarea>
</div>
<a class="button" href="" id="toGeo">convert to GeoJSON &rarr;</a>
</div>
<div id="about">
<p>osmtogeojson is a Javascript module for converting OSM data (OSM XML or Overpass JSON) to GeoJSON. It works in the browser, nodejs and can also be used as a command line tool. This OSM conversion code was written for and is maintained by the <a href="https://github.com/tyrasd/overpass-turbo">overpass-turbo</a> project.</p>
<span style="font-weight: bold;">Usage: </span>
<ul>
<li>In the browser:
<ul>
<li><code>
&lt;script src='osmtogeojson.js'>&lt;/script>
</code></li>
<li><code>
osmtogeojson(osm_data);
</code></li>
</ul>
</li>
<li>As a nodejs library:
<ul>
<li><code>
$ npm install osmtogeojson
</code></li>
<li><code>
var osmtogeojson = require('osmtogeojson');<br>
osmtogeojson(xml_data);
</code></li>
</ul>
</li>
<li>As a command line tool:
<ul>
<li><code>
$ npm install -g osmtogeojson
</code></li>
<li><code>
$ osmtogeojson file.osm > file.geojson
</code></li>
</ul>
</li>
</ul>
Read more about the API in the official <a href="https://github.com/tyrasd/osmtogeojson#usage">documentation</a>.
<div id="download">
<p><a class="button" href="https://github.com/tyrasd/osmtogeojson/raw/gh-pages/osmtogeojson.js">download osmtogeojson.js</a><br/><br/>
github: <a href="https://github.com/tyrasd/osmtogeojson">tyrasd/osmtogeojson</a><br/>
npm: <a href="https://npmjs.org/package/osmtogeojson">osmtogeojson</a><br/>
license: <a href="https://github.com/tyrasd/osmtogeojson/blob/gh-pages/LICENSE">MIT</a><br/>
</p>
</div>
</div>
</table>
</body>
</html>

View File

@@ -0,0 +1,945 @@
var _ = require("./lodash.custom.js");
var rewind = require("geojson-rewind");
// see https://wiki.openstreetmap.org/wiki/Overpass_turbo/Polygon_Features
var polygonFeatures = {};
require("osm-polygon-features").forEach(function(tags) {
if (tags.polygon === "all")
polygonFeatures[tags.key] = true;
else {
var list = (tags.polygon === "whitelist") ? "included_values" : "excluded_values",
tagValuesObj = {};
tags.values.forEach(function(value) { tagValuesObj[value] = true; });
polygonFeatures[tags.key] = {};
polygonFeatures[tags.key][list] = tagValuesObj;
}
});
var osmtogeojson = {};
osmtogeojson = function( data, options ) {
options = _.merge(
{
verbose: false,
flatProperties: false,
uninterestingTags: {
"source": true,
"source_ref": true,
"source:ref": true,
"history": true,
"attribution": true,
"created_by": true,
"tiger:county": true,
"tiger:tlid": true,
"tiger:upload_uuid": true
},
polygonFeatures: polygonFeatures,
},
options
);
var result;
if ( ((typeof XMLDocument !== "undefined") && data instanceof XMLDocument ||
(typeof XMLDocument === "undefined") && data.childNodes) )
result = _osmXML2geoJSON(data);
else
result = _overpassJSON2geoJSON(data);
return result;
function _overpassJSON2geoJSON(json) {
// sort elements
var nodes = new Array();
var ways = new Array();
var rels = new Array();
// helper functions
function centerGeometry(object) {
var pseudoNode = _.clone(object);
pseudoNode.lat = object.center.lat;
pseudoNode.lon = object.center.lon;
pseudoNode.__is_center_placeholder = true;
nodes.push(pseudoNode);
}
function boundsGeometry(object) {
var pseudoWay = _.clone(object);
pseudoWay.nodes = [];
function addPseudoNode(lat,lon,i) {
var pseudoNode = {
type:"node",
id: "_"+pseudoWay.type+"/"+pseudoWay.id+"bounds"+i,
lat: lat,
lon: lon
}
pseudoWay.nodes.push(pseudoNode.id);
nodes.push(pseudoNode);
}
addPseudoNode(pseudoWay.bounds.minlat,pseudoWay.bounds.minlon,1);
addPseudoNode(pseudoWay.bounds.maxlat,pseudoWay.bounds.minlon,2);
addPseudoNode(pseudoWay.bounds.maxlat,pseudoWay.bounds.maxlon,3);
addPseudoNode(pseudoWay.bounds.minlat,pseudoWay.bounds.maxlon,4);
pseudoWay.nodes.push(pseudoWay.nodes[0]);
pseudoWay.__is_bounds_placeholder = true;
ways.push(pseudoWay);
}
function fullGeometryWay(way) {
function addFullGeometryNode(lat,lon,id) {
var geometryNode = {
type:"node",
id: id,
lat: lat,
lon: lon,
__is_uninteresting: true
}
nodes.push(geometryNode);
}
if (!_.isArray(way.nodes)) {
way.nodes = way.geometry.map(function(nd) {
if (nd !== null) // have to skip ref-less nodes
return "_anonymous@"+nd.lat+"/"+nd.lon;
else
return "_anonymous@unknown_location";
});
}
way.geometry.forEach(function(nd, i) {
if (nd) {
addFullGeometryNode(
nd.lat,
nd.lon,
way.nodes[i]
);
}
});
}
function fullGeometryRelation(rel) {
function addFullGeometryNode(lat,lon,id) {
var geometryNode = {
type:"node",
id: id,
lat: lat,
lon: lon
}
nodes.push(geometryNode);
}
function addFullGeometryWay(geometry,id) {
// shared multipolygon ways cannot be defined multiple times with the same id.
if (ways.some(function (way) { // todo: this is slow :(
return way.type == "way" && way.id == id;
})) return;
var geometryWay = {
type: "way",
id: id,
nodes:[]
}
function addFullGeometryWayPseudoNode(lat,lon) {
// todo? do not save the same pseudo node multiple times
var geometryPseudoNode = {
type:"node",
id: "_anonymous@"+lat+"/"+lon,
lat: lat,
lon: lon,
__is_uninteresting: true
}
geometryWay.nodes.push(geometryPseudoNode.id);
nodes.push(geometryPseudoNode);
}
geometry.forEach(function(nd) {
if (nd) {
addFullGeometryWayPseudoNode(
nd.lat,
nd.lon
);
} else {
geometryWay.nodes.push(undefined);
}
});
ways.push(geometryWay);
}
rel.members.forEach(function(member, i) {
if (member.type == "node") {
if (member.lat) {
addFullGeometryNode(
member.lat,
member.lon,
member.ref
);
}
} else if (member.type == "way") {
if (member.geometry) {
member.ref = "_fullGeom"+member.ref;
addFullGeometryWay(
member.geometry,
member.ref
);
}
}
});
}
// create copies of individual json objects to make sure the original data doesn't get altered
// todo: cloning is slow: see if this can be done differently!
for (var i=0;i<json.elements.length;i++) {
switch (json.elements[i].type) {
case "node":
var node = json.elements[i];
nodes.push(node);
break;
case "way":
var way = _.clone(json.elements[i]);
way.nodes = _.clone(way.nodes);
ways.push(way);
if (way.center)
centerGeometry(way);
if (way.geometry)
fullGeometryWay(way);
else if (way.bounds)
boundsGeometry(way);
break;
case "relation":
var rel = _.clone(json.elements[i]);
rel.members = _.clone(rel.members);
rels.push(rel);
var has_full_geometry = rel.members && rel.members.some(function (member) {
return member.type == "node" && member.lat ||
member.type == "way" && member.geometry && member.geometry.length > 0
});
if (rel.center)
centerGeometry(rel);
if (has_full_geometry)
fullGeometryRelation(rel);
else if (rel.bounds)
boundsGeometry(rel);
break;
default:
// type=area (from coord-query) is an example for this case.
}
}
return _convert2geoJSON(nodes,ways,rels);
}
function _osmXML2geoJSON(xml) {
// sort elements
var nodes = new Array();
var ways = new Array();
var rels = new Array();
// helper function
function copy_attribute( x, o, attr ) {
if (x.hasAttribute(attr))
o[attr] = x.getAttribute(attr);
}
function centerGeometry(object, centroid) {
var pseudoNode = _.clone(object);
copy_attribute(centroid, pseudoNode, 'lat');
copy_attribute(centroid, pseudoNode, 'lon');
pseudoNode.__is_center_placeholder = true;
nodes.push(pseudoNode);
}
function boundsGeometry(object, bounds) {
var pseudoWay = _.clone(object);
pseudoWay.nodes = [];
function addPseudoNode(lat,lon,i) {
var pseudoNode = {
type:"node",
id: "_"+pseudoWay.type+"/"+pseudoWay.id+"bounds"+i,
lat: lat,
lon: lon
}
pseudoWay.nodes.push(pseudoNode.id);
nodes.push(pseudoNode);
}
addPseudoNode(bounds.getAttribute('minlat'),bounds.getAttribute('minlon'),1);
addPseudoNode(bounds.getAttribute('maxlat'),bounds.getAttribute('minlon'),2);
addPseudoNode(bounds.getAttribute('maxlat'),bounds.getAttribute('maxlon'),3);
addPseudoNode(bounds.getAttribute('minlat'),bounds.getAttribute('maxlon'),4);
pseudoWay.nodes.push(pseudoWay.nodes[0]);
pseudoWay.__is_bounds_placeholder = true;
ways.push(pseudoWay);
}
function fullGeometryWay(way, nds) {
function addFullGeometryNode(lat,lon,id) {
var geometryNode = {
type:"node",
id: id,
lat: lat,
lon: lon,
__is_uninteresting: true
}
nodes.push(geometryNode);
return geometryNode.id;
}
if (!_.isArray(way.nodes)) {
way.nodes = [];
_.each( nds, function( nd, i ) {
way.nodes.push("_anonymous@"+nd.getAttribute('lat')+"/"+nd.getAttribute('lon'));
});
}
_.each( nds, function( nd, i ) {
if (nd.getAttribute('lat')) {
addFullGeometryNode(
nd.getAttribute('lat'),
nd.getAttribute('lon'),
way.nodes[i]
);
}
});
}
function fullGeometryRelation(rel, members) {
function addFullGeometryNode(lat,lon,id) {
var geometryNode = {
type:"node",
id: id,
lat: lat,
lon: lon
}
nodes.push(geometryNode);
}
function addFullGeometryWay(nds,id) {
// shared multipolygon ways cannot be defined multiple times with the same id.
if (ways.some(function (way) { // todo: this is slow :(
return way.type == "way" && way.id == id;
})) return;
var geometryWay = {
type: "way",
id: id,
nodes:[]
}
function addFullGeometryWayPseudoNode(lat,lon) {
// todo? do not save the same pseudo node multiple times
var geometryPseudoNode = {
type:"node",
id: "_anonymous@"+lat+"/"+lon,
lat: lat,
lon: lon,
__is_uninteresting: true
}
geometryWay.nodes.push(geometryPseudoNode.id);
nodes.push(geometryPseudoNode);
}
_.each(nds, function(nd) {
if (nd.getAttribute('lat')) {
addFullGeometryWayPseudoNode(
nd.getAttribute('lat'),
nd.getAttribute('lon')
);
} else {
geometryWay.nodes.push(undefined);
}
});
ways.push(geometryWay);
}
_.each( members, function( member, i ) {
if (rel.members[i].type == "node") {
if (member.getAttribute('lat')) {
addFullGeometryNode(
member.getAttribute('lat'),
member.getAttribute('lon'),
rel.members[i].ref
);
}
} else if (rel.members[i].type == "way") {
if (member.getElementsByTagName('nd').length > 0) {
rel.members[i].ref = "_fullGeom"+rel.members[i].ref;
addFullGeometryWay(
member.getElementsByTagName('nd'),
rel.members[i].ref
);
}
}
});
}
// nodes
_.each( xml.getElementsByTagName('node'), function( node, i ) {
var tags = {};
_.each( node.getElementsByTagName('tag'), function( tag ) {
tags[tag.getAttribute('k')] = tag.getAttribute('v');
});
var nodeObject = {
'type': 'node'
};
copy_attribute( node, nodeObject, 'id' );
copy_attribute( node, nodeObject, 'lat' );
copy_attribute( node, nodeObject, 'lon' );
copy_attribute( node, nodeObject, 'version' );
copy_attribute( node, nodeObject, 'timestamp' );
copy_attribute( node, nodeObject, 'changeset' );
copy_attribute( node, nodeObject, 'uid' );
copy_attribute( node, nodeObject, 'user' );
if (!_.isEmpty(tags))
nodeObject.tags = tags;
nodes.push(nodeObject);
});
// ways
var centroid,bounds;
_.each( xml.getElementsByTagName('way'), function( way, i ) {
var tags = {};
var wnodes = [];
_.each( way.getElementsByTagName('tag'), function( tag ) {
tags[tag.getAttribute('k')] = tag.getAttribute('v');
});
var has_full_geometry = false;
_.each( way.getElementsByTagName('nd'), function( nd, i ) {
var id;
if (id = nd.getAttribute('ref'))
wnodes[i] = id;
if (!has_full_geometry && nd.getAttribute('lat'))
has_full_geometry = true;
});
var wayObject = {
"type": "way"
};
copy_attribute( way, wayObject, 'id' );
copy_attribute( way, wayObject, 'version' );
copy_attribute( way, wayObject, 'timestamp' );
copy_attribute( way, wayObject, 'changeset' );
copy_attribute( way, wayObject, 'uid' );
copy_attribute( way, wayObject, 'user' );
if (wnodes.length > 0)
wayObject.nodes = wnodes;
if (!_.isEmpty(tags))
wayObject.tags = tags;
if (centroid = way.getElementsByTagName('center')[0])
centerGeometry(wayObject,centroid);
if (has_full_geometry)
fullGeometryWay(wayObject, way.getElementsByTagName('nd'));
else if (bounds = way.getElementsByTagName('bounds')[0])
boundsGeometry(wayObject,bounds);
ways.push(wayObject);
});
// relations
_.each( xml.getElementsByTagName('relation'), function( relation, i ) {
var tags = {};
var members = [];
_.each( relation.getElementsByTagName('tag'), function( tag ) {
tags[tag.getAttribute('k')] = tag.getAttribute('v');
});
var has_full_geometry = false;
_.each( relation.getElementsByTagName('member'), function( member, i ) {
members[i] = {};
copy_attribute( member, members[i], 'ref' );
copy_attribute( member, members[i], 'role' );
copy_attribute( member, members[i], 'type' );
if (!has_full_geometry &&
(members[i].type == 'node' && member.getAttribute('lat')) ||
(members[i].type == 'way' && member.getElementsByTagName('nd').length>0) )
has_full_geometry = true;
});
var relObject = {
"type": "relation"
}
copy_attribute( relation, relObject, 'id' );
copy_attribute( relation, relObject, 'version' );
copy_attribute( relation, relObject, 'timestamp' );
copy_attribute( relation, relObject, 'changeset' );
copy_attribute( relation, relObject, 'uid' );
copy_attribute( relation, relObject, 'user' );
if (members.length > 0)
relObject.members = members;
if (!_.isEmpty(tags))
relObject.tags = tags;
if (centroid = relation.getElementsByTagName('center')[0])
centerGeometry(relObject,centroid);
if (has_full_geometry)
fullGeometryRelation(relObject, relation.getElementsByTagName('member'));
else if (bounds = relation.getElementsByTagName('bounds')[0])
boundsGeometry(relObject,bounds);
rels.push(relObject);
});
return _convert2geoJSON(nodes,ways,rels);
}
function _convert2geoJSON(nodes,ways,rels) {
// helper function that checks if there are any tags other than "created_by", "source", etc. or any tag provided in ignore_tags
function has_interesting_tags(t, ignore_tags) {
if (typeof ignore_tags !== "object")
ignore_tags={};
if (typeof options.uninterestingTags === "function")
return !options.uninterestingTags(t, ignore_tags);
for (var k in t)
if (!(options.uninterestingTags[k]===true) &&
!(ignore_tags[k]===true || ignore_tags[k]===t[k]))
return true;
return false;
};
// helper function to extract meta information
function build_meta_information(object) {
var res = {
"timestamp": object.timestamp,
"version": object.version,
"changeset": object.changeset,
"user": object.user,
"uid": object.uid
};
for (var k in res)
if (res[k] === undefined)
delete res[k];
return res;
}
// some data processing (e.g. filter nodes only used for ways)
var nodeids = new Object();
for (var i=0;i<nodes.length;i++) {
if (nodes[i].lat === undefined) {
if (options.verbose) console.warn('Node',nodes[i].type+'/'+nodes[i].id,'ignored because it has no coordinates');
continue; // ignore nodes without coordinates (e.g. returned by an ids_only query)
}
nodeids[nodes[i].id] = nodes[i];
}
var poinids = new Object();
for (var i=0;i<nodes.length;i++) {
if (typeof nodes[i].tags != 'undefined' &&
has_interesting_tags(nodes[i].tags)) // this checks if the node has any tags other than "created_by"
poinids[nodes[i].id] = true;
}
for (var i=0;i<rels.length;i++) {
if (!_.isArray(rels[i].members)) {
if (options.verbose) console.warn('Relation',rels[i].type+'/'+rels[i].id,'ignored because it has no members');
continue; // ignore relations without members (e.g. returned by an ids_only query)
}
for (var j=0;j<rels[i].members.length;j++) {
if (rels[i].members[j].type == "node")
poinids[rels[i].members[j].ref] = true;
}
}
var wayids = new Object();
var waynids = new Object();
for (var i=0;i<ways.length;i++) {
if (!_.isArray(ways[i].nodes)) {
if (options.verbose) console.warn('Way',ways[i].type+'/'+ways[i].id,'ignored because it has no nodes');
continue; // ignore ways without nodes (e.g. returned by an ids_only query)
}
wayids[ways[i].id] = ways[i];
for (var j=0;j<ways[i].nodes.length;j++) {
waynids[ways[i].nodes[j]] = true;
ways[i].nodes[j] = nodeids[ways[i].nodes[j]];
}
}
var pois = new Array();
for (var i=0;i<nodes.length;i++) {
if (((!waynids[nodes[i].id]) ||
(poinids[nodes[i].id])) &&
!nodes[i].__is_uninteresting)
pois.push(nodes[i]);
}
var relids = new Array();
for (var i=0;i<rels.length;i++) {
if (!_.isArray(rels[i].members)) {
if (options.verbose) console.warn('Relation',rels[i].type+'/'+rels[i].id,'ignored because it has no members');
continue; // ignore relations without members (e.g. returned by an ids_only query)
}
relids[rels[i].id] = rels[i];
}
var relsmap = {node: {}, way: {}, relation: {}};
for (var i=0;i<rels.length;i++) {
if (!_.isArray(rels[i].members)) {
if (options.verbose) console.warn('Relation',rels[i].type+'/'+rels[i].id,'ignored because it has no members');
continue; // ignore relations without members (e.g. returned by an ids_only query)
}
for (var j=0;j<rels[i].members.length;j++) {
var m_type = rels[i].members[j].type;
var m_ref = rels[i].members[j].ref;
if (typeof m_ref !== "number") {
// de-namespace full geometry content
m_ref = m_ref.replace("_fullGeom", "");
}
if (!relsmap[m_type]) {
if (options.verbose) console.warn('Relation',rels[i].type+'/'+rels[i].id,'member',m_type+'/'+m_ref,'ignored because it has an invalid type');
continue;
}
if (typeof relsmap[m_type][m_ref] === "undefined")
relsmap[m_type][m_ref] = [];
relsmap[m_type][m_ref].push({
"role" : rels[i].members[j].role,
"rel" : rels[i].id,
"reltags" : rels[i].tags,
});
}
}
// construct geojson
var geojson;
var geojsonnodes = {
"type" : "FeatureCollection",
"features" : new Array()};
for (i=0;i<pois.length;i++) {
if (typeof pois[i].lon == "undefined" || typeof pois[i].lat == "undefined") {
if (options.verbose) console.warn('POI',pois[i].type+'/'+pois[i].id,'ignored because it lacks coordinates');
continue; // lon and lat are required for showing a point
}
var feature = {
"type" : "Feature",
"id" : pois[i].type+"/"+pois[i].id,
"properties" : {
"type" : pois[i].type,
"id" : pois[i].id,
"tags" : pois[i].tags || {},
"relations" : relsmap["node"][pois[i].id] || [],
"meta": build_meta_information(pois[i])
},
"geometry" : {
"type" : "Point",
"coordinates" : [+pois[i].lon, +pois[i].lat],
}
};
if (pois[i].__is_center_placeholder)
feature.properties["geometry"] = "center";
geojsonnodes.features.push(feature);
}
var geojsonlines = {
"type" : "FeatureCollection",
"features" : new Array()};
var geojsonpolygons = {
"type" : "FeatureCollection",
"features" : new Array()};
// process multipolygons
for (var i=0;i<rels.length;i++) {
if ((typeof rels[i].tags != "undefined") &&
(rels[i].tags["type"] == "multipolygon" || rels[i].tags["type"] == "boundary")) {
if (!_.isArray(rels[i].members)) {
if (options.verbose) console.warn('Multipolygon',rels[i].type+'/'+rels[i].id,'ignored because it has no members');
continue; // ignore relations without members (e.g. returned by an ids_only query)
}
var outer_count = 0;
for (var j=0;j<rels[i].members.length;j++)
if (rels[i].members[j].role == "outer")
outer_count++;
else if (options.verbose && rels[i].members[j].role != "inner")
console.warn('Multipolygon',rels[i].type+'/'+rels[i].id,'member',rels[i].members[j].type+'/'+rels[i].members[j].ref,'ignored because it has an invalid role: "' + rels[i].members[j].role + '"');
rels[i].members.forEach(function(m) {
if (wayids[m.ref]) {
// this even works in the following corner case:
// a multipolygon amenity=xxx with outer line tagged amenity=yyy
// see https://github.com/tyrasd/osmtogeojson/issues/7
if (m.role==="outer" && !has_interesting_tags(wayids[m.ref].tags,rels[i].tags))
wayids[m.ref].is_multipolygon_outline = true;
if (m.role==="inner" && !has_interesting_tags(wayids[m.ref].tags))
wayids[m.ref].is_multipolygon_outline = true;
}
});
if (outer_count == 0) {
if (options.verbose) console.warn('Multipolygon relation',rels[i].type+'/'+rels[i].id,'ignored because it has no outer ways');
continue; // ignore multipolygons without outer ways
}
var simple_mp = false;
var mp_geometry = '';
if (outer_count == 1 && !has_interesting_tags(rels[i].tags, {"type":true}))
simple_mp = true;
var feature = null;
if (!simple_mp) {
feature = construct_multipolygon(rels[i], rels[i]);
} else {
// simple multipolygon
var outer_way = rels[i].members.filter(function(m) {return m.role === "outer";})[0];
outer_way = wayids[outer_way.ref];
if (outer_way === undefined) {
if (options.verbose) console.warn('Multipolygon relation',rels[i].type+'/'+rels[i].id,'ignored because outer way', outer_way.type+'/'+outer_way.ref,'is missing');
continue; // abort if outer way object is not present
}
outer_way.is_multipolygon_outline = true;
feature = construct_multipolygon(outer_way, rels[i]);
}
if (feature === false) {
if (options.verbose) console.warn('Multipolygon relation',rels[i].type+'/'+rels[i].id,'ignored because it has invalid geometry');
continue; // abort if feature could not be constructed
}
geojsonpolygons.features.push(feature);
function construct_multipolygon(tag_object, rel) {
var is_tainted = false;
var mp_geometry = simple_mp ? 'way' : 'relation',
mp_id = typeof tag_object.id === "number" ? tag_object.id : +(tag_object.id.replace("_fullGeom", ""));
// prepare mp members
var members;
members = rel.members.filter(function(m) {return m.type === "way";});
members = members.map(function(m) {
var way = wayids[m.ref];
if (way === undefined) { // check for missing ways
if (options.verbose) console.warn('Multipolygon', mp_geometry+'/'+mp_id, 'tainted by a missing way', m.type+'/'+m.ref);
is_tainted = true;
return;
}
return { // TODO: this is slow! :(
id: m.ref,
role: m.role || "outer",
way: way,
nodes: way.nodes.filter(function(n) {
if (n !== undefined)
return true;
is_tainted = true;
if (options.verbose) console.warn('Multipolygon', mp_geometry+'/'+mp_id, 'tainted by a way', m.type+'/'+m.ref, 'with a missing node');
return false;
})
};
});
members = _.compact(members);
// construct outer and inner rings
var outers, inners;
function join(ways) {
var _first = function(arr) {return arr[0]};
var _last = function(arr) {return arr[arr.length-1]};
// stolen from iD/relation.js
var joined = [], current, first, last, i, how, what;
while (ways.length) {
current = ways.pop().nodes.slice();
joined.push(current);
while (ways.length && _first(current) !== _last(current)) {
first = _first(current);
last = _last(current);
for (i = 0; i < ways.length; i++) {
what = ways[i].nodes;
if (last === _first(what)) {
how = current.push;
what = what.slice(1);
break;
} else if (last === _last(what)) {
how = current.push;
what = what.slice(0, -1).reverse();
break;
} else if (first == _last(what)) {
how = current.unshift;
what = what.slice(0, -1);
break;
} else if (first == _first(what)) {
how = current.unshift;
what = what.slice(1).reverse();
break;
} else {
what = how = null;
}
}
if (!what) {
if (options.verbose) console.warn('Multipolygon', mp_geometry+'/'+mp_id, 'contains unclosed ring geometry');
break; // Invalid geometry (dangling way, unclosed ring)
}
ways.splice(i, 1);
how.apply(current, what);
}
}
return joined;
}
outers = join(members.filter(function(m) {return m.role==="outer";}));
inners = join(members.filter(function(m) {return m.role==="inner";}));
// sort rings
var mp;
function findOuter(inner) {
var polygonIntersectsPolygon = function(outer, inner) {
for (var i=0; i<inner.length; i++)
if (pointInPolygon(inner[i], outer))
return true;
return false;
}
var mapCoordinates = function(from) {
return from.map(function(n) {
return [+n.lat,+n.lon];
});
}
// stolen from iD/geo.js,
// based on https://github.com/substack/point-in-polygon,
// ray-casting algorithm based on http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html
var pointInPolygon = function(point, polygon) {
var x = point[0], y = point[1], inside = false;
for (var i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {
var xi = polygon[i][0], yi = polygon[i][1];
var xj = polygon[j][0], yj = polygon[j][1];
var intersect = ((yi > y) != (yj > y)) &&
(x < (xj - xi) * (y - yi) / (yj - yi) + xi);
if (intersect) inside = !inside;
}
return inside;
};
// stolen from iD/relation.js
var o, outer;
// todo: all this coordinate mapping makes this unneccesarily slow.
// see the "todo: this is slow! :(" above.
inner = mapCoordinates(inner);
/*for (o = 0; o < outers.length; o++) {
outer = mapCoordinates(outers[o]);
if (polygonContainsPolygon(outer, inner))
return o;
}*/
for (o = 0; o < outers.length; o++) {
outer = mapCoordinates(outers[o]);
if (polygonIntersectsPolygon(outer, inner))
return o;
}
}
mp = outers.map(function(o) {return [o];});
for (var j=0; j<inners.length; j++) {
var o = findOuter(inners[j]);
if (o !== undefined)
mp[o].push(inners[j]);
else
if (options.verbose) console.warn('Multipolygon', mp_geometry+'/'+mp_id, 'contains an inner ring with no containing outer');
// so, no outer ring for this inner ring is found.
// We're going to ignore holes in empty space.
;
}
// sanitize mp-coordinates (remove empty clusters or rings, {lat,lon,...} to [lon,lat]
var mp_coords = [];
mp_coords = _.compact(mp.map(function(cluster) {
var cl = _.compact(cluster.map(function(ring) {
if (ring.length < 4) { // todo: is this correct: ring.length < 4 ?
if (options.verbose) console.warn('Multipolygon', mp_geometry+'/'+mp_id, 'contains a ring with less than four nodes');
return;
}
return _.compact(ring.map(function(node) {
return [+node.lon,+node.lat];
}));
}));
if (cl.length == 0) {
if (options.verbose) console.warn('Multipolygon', mp_geometry+'/'+mp_id, 'contains an empty ring cluster');
return;
}
return cl;
}));
if (mp_coords.length == 0) {
if (options.verbose) console.warn('Multipolygon', mp_geometry+'/'+mp_id, 'contains no coordinates');
return false; // ignore multipolygons without coordinates
}
var mp_type = "MultiPolygon";
if (mp_coords.length === 1) {
mp_type = "Polygon";
mp_coords = mp_coords[0];
}
// mp parsed, now construct the geoJSON
var feature = {
"type" : "Feature",
"id" : tag_object.type+"/"+mp_id,
"properties" : {
"type" : tag_object.type,
"id" : mp_id,
"tags" : tag_object.tags || {},
"relations" : relsmap[tag_object.type][tag_object.id] || [],
"meta": build_meta_information(tag_object)
},
"geometry" : {
"type" : mp_type,
"coordinates" : mp_coords,
}
}
if (is_tainted) {
if (options.verbose) console.warn('Multipolygon', mp_geometry+'/'+mp_id, 'is tainted');
feature.properties["tainted"] = true;
}
return feature;
}
}
}
// process lines and polygons
for (var i=0;i<ways.length;i++) {
if (!_.isArray(ways[i].nodes)) {
if (options.verbose) console.warn('Way',ways[i].type+'/'+ways[i].id,'ignored because it has no nodes');
continue; // ignore ways without nodes (e.g. returned by an ids_only query)
}
if (ways[i].is_multipolygon_outline)
continue; // ignore ways which are already rendered as (part of) a multipolygon
if (typeof ways[i].id !== "number") {
// remove full geometry namespace for output
ways[i].id = +ways[i].id.replace("_fullGeom", "");
}
ways[i].tainted = false;
ways[i].hidden = false;
var coords = new Array();
for (j=0;j<ways[i].nodes.length;j++) {
if (typeof ways[i].nodes[j] == "object")
coords.push([+ways[i].nodes[j].lon, +ways[i].nodes[j].lat]);
else {
if (options.verbose) console.warn('Way',ways[i].type+'/'+ways[i].id,'is tainted by an invalid node');
ways[i].tainted = true;
}
}
if (coords.length <= 1) { // invalid way geometry
if (options.verbose) console.warn('Way',ways[i].type+'/'+ways[i].id,'ignored because it contains too few nodes');
continue;
}
var way_type = "LineString"; // default
if (typeof ways[i].nodes[0] != "undefined" && // way has its nodes loaded
ways[i].nodes[0] === ways[i].nodes[ways[i].nodes.length-1] && // ... and forms a closed ring
(
typeof ways[i].tags != "undefined" && // ... and has tags
_isPolygonFeature(ways[i].tags) // ... and tags say it is a polygon
|| // or is a placeholder for a bounds geometry
ways[i].__is_bounds_placeholder
)
) {
way_type = "Polygon";
coords = [coords];
}
var feature = {
"type" : "Feature",
"id" : ways[i].type+"/"+ways[i].id,
"properties" : {
"type" : ways[i].type,
"id" : ways[i].id,
"tags" : ways[i].tags || {},
"relations" : relsmap["way"][ways[i].id] || [],
"meta": build_meta_information(ways[i])
},
"geometry" : {
"type" : way_type,
"coordinates" : coords,
}
}
if (ways[i].tainted) {
if (options.verbose) console.warn('Way',ways[i].type+'/'+ways[i].id,'is tainted');
feature.properties["tainted"] = true;
}
if (ways[i].__is_bounds_placeholder)
feature.properties["geometry"] = "bounds";
if (way_type == "LineString")
geojsonlines.features.push(feature);
else
geojsonpolygons.features.push(feature);
}
geojson = {
"type": "FeatureCollection",
"features": []
};
geojson.features = geojson.features.concat(geojsonpolygons.features);
geojson.features = geojson.features.concat(geojsonlines.features);
geojson.features = geojson.features.concat(geojsonnodes.features);
// optionally, flatten properties
if (options.flatProperties) {
geojson.features.forEach(function(f) {
f.properties = _.merge(
f.properties.meta,
f.properties.tags,
{id: f.properties.type+"/"+f.properties.id}
);
});
}
// fix polygon winding
geojson = rewind(geojson, true /*remove for geojson-rewind >0.1.0*/);
return geojson;
}
function _isPolygonFeature( tags ) {
var polygonFeatures = options.polygonFeatures;
if (typeof polygonFeatures === "function")
return polygonFeatures(tags);
// explicitely tagged non-areas
if ( tags['area'] === 'no' )
return false;
// assuming that a typical OSM way has in average less tags than
// the polygonFeatures list, this way around should be faster
for ( var key in tags ) {
var val = tags[key];
var pfk = polygonFeatures[key];
// continue with next if tag is unknown or not "categorizing"
if ( typeof pfk === 'undefined' )
continue;
// continue with next if tag is explicitely un-set ("building=no")
if ( val === 'no' )
continue;
// check polygon features for: general acceptance, included or excluded values
if ( pfk === true )
return true;
if ( pfk.included_values && pfk.included_values[val] === true )
return true;
if ( pfk.excluded_values && pfk.excluded_values[val] !== true )
return true;
}
// if no tags matched, this ain't no area.
return false;
}
};
// for backwards compatibility
osmtogeojson.toGeojson = osmtogeojson;
module.exports = osmtogeojson;

File diff suppressed because it is too large Load Diff

147
assets/osmtogeojson/osmtogeojson Executable file
View File

@@ -0,0 +1,147 @@
#!/usr/bin/env node
var osmtogeojson = require('./'),
opt = require('optimist')
.usage('Usage: $0 [-f format] [-e] [-v] FILE')
.string('f').describe('f', 'file format. if not given, will be detected from filename. supported values: osm, json')
.boolean('e').describe('e', 'enhanced properties. if set, the resulting GeoJSON feature\'s properties will contain more structured information')
.boolean('n').describe('n', 'numeric properties. if set, the resulting GeoJSON feature\'s properties will be numbers if possible')
.boolean('v').describe('v', 'verbose mode. output diagnostic information during processing')
.boolean('m').describe('m', 'minify output json (no identation and linebreaks)')
.boolean('version').describe('version','display software version')
.boolean('help').describe('help','print this help message'),
argv = opt.argv,
fs = require('fs'),
concat = require('concat-stream'),
xmldom = new (require('xmldom').DOMParser)(),
osmxmlParser = require('./parse_osmxml.js'),
JSONStream = require('JSONStream'),
geojsonNumeric = require('geojson-numeric'),
pack = require('./package.json');
if (argv.help) {
return opt.showHelp();
}
if (argv.version) {
process.stdout.write(pack.version+'\n');
return;
}
var filename = argv._[0] || '';
var enhanced_geojson = argv.e;
var format = argv.f;
if (format === 'xml') format = 'osm';
// detect file format from filename
if (!format) {
if (filename.match(/\.osm$/i)) format = 'osm';
if (filename.match(/\.xml$/i)) format = 'osm';
if (filename.match(/\.json$/i)) format = 'json';
}
// fall back to the native JSON parser if the file is small enough
// (unfortunately, the streaming JSON parser isn't very fast)
if (format === 'json' && filename) {
if (fs.statSync(filename).size < 268435577)
format = 'nativejson';
}
// fall back to autodetection if still no format
if (!format) format = 'auto';
var datastream = (filename ? fs.createReadStream(filename) : process.stdin);
// use streaming parsers if format is already known
switch(format) {
case 'json':
case 'streamjson':
datastream.pipe(JSONStream.parse())
.on('root', function(data) {
// iron out some nasty floating point rounding errors
if (data.version) data.version = Math.round(data.version*1000)/1000;
data.elements.forEach(function(element) {
if (element.lat) element.lat = Math.round(element.lat*1E12)/1E12;
if (element.lon) element.lon = Math.round(element.lon*1E12)/1E12;
});
// convert to geojson
convert(data);
})
.on('error', function(err) {
process.stderr.write("ERROR: JSON input stream could not be parsed.\n");
process.exit(1);
});
break;
case 'osm':
case 'streamxml':
datastream
.on('data', function(chunk) {
osmxmlParser.write(chunk);
})
.on('end', function() {
osmxmlParser.end();
data = osmxmlParser.getJSON();
convert(data);
});
datastream.resume();
break;
default:
// otherwise use leagacy non-streaming parsers
datastream.pipe(concat(legacyParsers));
}
function legacyParsers(data) {
if (!data) data = ''; else data = data.toString();
if (format === 'auto') {
if (data.match(/^\s*</)) // (osm) xml files begin with a "<"
format = 'osm';
else if (data.match(/^\s*{/)) // osm json files begin with a "{"
format = 'json';
else {
format = 'unknown';
}
}
switch (format) {
case 'xmldom':
data = xmldom.parseFromString(data);
break;
case 'json':
case 'nativejson':
data = JSON.parse(data);
break;
case 'osm':
case 'fastxml':
data = osmxmlParser.parseFromString(data);
break;
default:
process.stderr.write('This doesn\'t look like a recognized file format.\n');
opt.showHelp();
process.exit(1);
}
convert(data);
}
function convert(data) {
var geojson = osmtogeojson(data, {
flatProperties: !enhanced_geojson,
verbose: argv.v
});
output(geojson);
}
function output(geojson) {
// this is much faster than a simple JSON.stringify of the whole geojson
// object. also, this is less memory intensive and output starts right
// after the conversion without any additional delay
process.stdout.on('error', function() {});
var separator = argv.m ? '' : '\n';
process.stdout.write('{'+separator+'"type": "FeatureCollection",'+separator+'"features": ['+separator);
geojson.features.forEach(function(f,i) {
if (argv.n)
f = geojsonNumeric(f,argv.e);
process.stdout.write(JSON.stringify(f, null, argv.m ? 0 : 2));
if (i != geojson.features.length-1)
process.stdout.write(','+separator);
});
process.stdout.write(separator+']'+separator+'}'+separator);
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,47 @@
{
"name": "osmtogeojson",
"version": "2.2.12",
"description": "convert OSM to geojson",
"main": "index.js",
"scripts": {
"pretest": "npm ls --depth=Infinity > /dev/null",
"test": "npm run test-lib && npm run test-cli",
"test-lib": "mocha -R spec",
"test-cli": "node test-cli/cli.test.js | faucet"
},
"bin": {
"osmtogeojson": "osmtogeojson"
},
"repository": {
"type": "git",
"url": "https://github.com/tyrasd/osmtogeojson.git"
},
"keywords": [
"openstreetmap",
"geojson"
],
"author": "Martin Raifer",
"license": "MIT",
"bugs": {
"url": "https://github.com/tyrasd/osmtogeojson/issues"
},
"dependencies": {
"JSONStream": "0.8.0",
"concat-stream": "~1.0.1",
"geojson-numeric": "0.2.0",
"geojson-rewind": "0.1.0",
"htmlparser2": "3.5.1",
"optimist": "~0.3.5",
"osm-polygon-features": "^0.9.1",
"xmldom": "~0.1.16"
},
"devDependencies": {
"expect.js": "~0.2.0",
"mocha": "~1.12.0",
"tape": "~2.10.2",
"faucet": "~0.0.1"
},
"engines": {
"node": ">=0.5"
}
}

View File

@@ -0,0 +1,91 @@
/* converts OSM XML to OSM JSON using a fast streaming parser */
var htmlparser = require('htmlparser2');
var _ = require("./lodash.custom.js");
var json = {
"version": 0.6,
"elements": []
};
var buffer = {};
var p = new htmlparser.Parser({
onopentag: function(name, attr) {
switch (name) {
case "node":
case "way":
case "relation":
buffer = {
type: name,
tags: {}
}
_.merge(buffer, attr);
if (name === "way") {
buffer.nodes = [];
buffer.geometry = [];
}
if (name === "relation") {
buffer.members = [];
buffer.nodes = [];
buffer.geometry = [];
}
break;
case "tag":
buffer.tags[attr.k] = attr.v;
break;
case "nd":
buffer.nodes.push(attr.ref);
if (attr.lat) {
buffer.geometry.push({
lat: attr.lat,
lon: attr.lon
});
} else {
buffer.geometry.push(null);
}
break;
case "member":
buffer.members.push(attr);
break;
case "center":
buffer.center = {
lat: attr.lat,
lon: attr.lon
};
break;
case "bounds":
buffer.bounds = {
minlat: attr.minlat,
minlon: attr.minlon,
maxlat: attr.maxlat,
maxlon: attr.maxlon
};
}
},
ontext: function(text) {
},
onclosetag: function(name) {
if (name === "node" || name === "way" || name === "relation" || name === "area") {
// remove empty geometry or nodes arrays
if (buffer.geometry && buffer.geometry.every(function(g) {return g===null;}))
delete buffer.geometry;
if (name === "relation")
delete buffer.nodes;
json.elements.push(buffer);
}
if (name === "member") {
if (buffer.geometry) {
buffer.members[buffer.members.length-1].geometry = buffer.geometry;
buffer.geometry = [];
}
}
}
}, {
decodeEntities: true,
xmlMode: true
});
p.parseFromString = function(xml_str) { p.write(xml_str); p.end(); return json; }
p.getJSON = function() {
return json;
}
module.exports = p;

View File

@@ -3,7 +3,7 @@
"description":"Javascript libraries for the Leaflet maps integration for Contao",
"keywords":["contao", "maps", "leaflet"],
"type":"contao-module",
"license":"LGPL-3.0+",
"license":"LGPL-3.0-or-later",
"authors":[
{
"name":"David Molineus",
@@ -18,16 +18,16 @@
"source":"https://github.com/netzmacht/contao-leaflet-libraries"
},
"require":{
"php":">=5.4",
"contao/core":"~3.5"
"php":"^7.4 || ^8.0",
"contao/core-bundle":"^4.13 || ^5.0"
},
"suggest": {
"netzmacht/contao-leaflet-maps": "Leaflet maps integration into Contao CMS"
},
"extra":{
"branch-alias": {
"dev-master": "1.0.x-dev",
"dev-develop": "1.1.x-dev",
"dev-master": "1.3.x-dev",
"dev-develop": "1.4.x-dev",
"dev-support/0.7.x": "0.7.x-dev"
},
"contao": {

View File

@@ -1,9 +1,10 @@
var gulp = require('gulp');
const { series, parallel, src, dest } = require('gulp');
var del = require('del');
var rename = require('gulp-rename');
var uglify = require('gulp-uglify');
var merge = require('merge-stream');
var minifyCss = require('gulp-minify-css');
var minifyCss = require('gulp-clean-css');
var replace = require('gulp-replace');
var paths = [
@@ -32,9 +33,9 @@ var paths = [
}
];
gulp.task('clear-styles', function() {
function clearStyles (cb) {
var i, clear = [];
for (i = 0; i < paths.length; i++) {
if (paths[i].css) {
clear.push(paths[i].dest + '/*.min.css');
@@ -42,9 +43,11 @@ gulp.task('clear-styles', function() {
}
del(clear);
});
gulp.task('clear-scripts', function() {
cb();
}
function clearScripts (cb) {
var i, clear = [];
for (i = 0; i < paths.length; i++) {
@@ -54,45 +57,53 @@ gulp.task('clear-scripts', function() {
}
del(clear);
});
gulp.task('scripts', ['clear-scripts'], function() {
cb();
}
const scripts = series(clearScripts, function (cb) {
var i, stream, streams = [];
for (i = 0; i < paths.length; i++) {
if (paths[i].js) {
stream = gulp.src(paths[i].dest + '/' + paths[i].js)
stream = src(paths[i].dest + '/' + paths[i].js)
.pipe(rename(function (path) {
path.basename += '.min';
}))
.pipe(uglify())
.pipe(gulp.dest(paths[i].dest));
.pipe(dest(paths[i].dest));
streams.push(stream);
}
}
return merge.call(null, streams);
merge.call(null, streams);
cb();
});
gulp.task('styles', ['clear-styles'], function() {
const styles = series(clearStyles, function (cb) {
var i, stream, streams = [];
for (i = 0; i < paths.length; i++) {
if (paths[i].css) {
stream = gulp.src(paths[i].dest + '/' + paths[i].css)
stream = src(paths[i].dest + '/' + paths[i].css)
.pipe(rename(function (path) {
path.basename += '.min';
}))
.pipe(minifyCss())
.pipe(replace(/url\(([^"][^\)]+)\)/g, 'url(\'$1\')'))
.pipe(gulp.dest(paths[i].dest));
.pipe(dest(paths[i].dest));
streams.push(stream);
}
}
return merge.call(null, streams);
});
merge.call(null, streams);
gulp.task('default', ['scripts', 'styles']);
cb();
})
exports.scripts = scripts;
exports.styles = styles;
exports.default = parallel(scripts, styles);

View File

@@ -17,7 +17,7 @@
$GLOBALS['LEAFLET_LIBRARIES']['leaflet'] = array
(
'name' => 'Leaflet',
'version' => '1.0.1',
'version' => '1.7.1',
'license' => '<a href="https://github.com/Leaflet/Leaflet/blob/master/LICENSE" target="_blank">BSD-2-Clause</a>',
'homepage' => 'http://leafletjs.com',
'css' => 'assets/leaflet/libs/leaflet/leaflet.min.css',
@@ -27,35 +27,35 @@ $GLOBALS['LEAFLET_LIBRARIES']['leaflet'] = array
$GLOBALS['LEAFLET_LIBRARIES']['leaflet-providers'] = array
(
'name' => 'Leaflet-providers',
'version' => '1.1.15',
'version' => '1.13.0',
'license' => '<a href="https://github.com/leaflet-extras/leaflet-providers/blob/master/license.md" target="_blank">BSD-2-Clause</a>',
'homepage' => 'http://leaflet-extras.github.io/leaflet-providers',
'javascript' => 'assets/leaflet/libs/leaflet-providers/leaflet-providers.min.js'
);
$GLOBALS['LEAFLET_LIBRARIES']['leaflet-omnivore'] = array
(
'name' => 'Leaflet-omnivore',
'version' => '0.3.2',
'license' => '<a href="https://github.com/mapbox/leaflet-omnivore/blob/master/LICENSE" target="_blank">BSD</a>',
'homepage' => 'https://github.com/mapbox/leaflet-omnivore',
'javascript' => 'assets/leaflet/libs/leaflet-omnivore/leaflet-omnivore.min.js'
);
$GLOBALS['LEAFLET_LIBRARIES']['leaflet-markercluster'] = array
(
'name' => 'Leaflet.markercluster',
'version' => '1.0.0',
'version' => '1.4.1',
'license' => '<a href="https://github.com/Leaflet/Leaflet.markercluster/blob/master/MIT-LICENCE.txt" target="_blank">MIT</a>',
'homepage' => 'https://github.com/Leaflet/Leaflet.markercluster',
'css' => 'assets/leaflet/libs/leaflet-markercluster/MarkerCluster.css',
'javascript' => 'assets/leaflet/libs/leaflet-markercluster/leaflet.markercluster.js'
);
$GLOBALS['LEAFLET_LIBRARIES']['leaflet-omnivore'] = array
(
'name' => 'Leaflet-omnivore',
'version' => '0.3.4',
'license' => '<a href="https://github.com/mapbox/leaflet-omnivore/blob/master/LICENSE" target="_blank">BSD</a>',
'homepage' => 'https://github.com/mapbox/leaflet-omnivore',
'javascript' => 'assets/leaflet/libs/leaflet-omnivore/leaflet-omnivore.min.js'
);
$GLOBALS['LEAFLET_LIBRARIES']['leaflet-loading'] = array
(
'name' => 'Leaflet.loading',
'version' => '0.1.23',
'version' => '0.1.24',
'license' => '<a href="https://github.com/ebrelsford/Leaflet.loading/blob/master/LICENSE" target="_blank">MIT</a>',
'homepage' => 'https://github.com/ebrelsford/Leaflet.loading',
'css' => 'assets/leaflet/libs/leaflet-loading/Control.Loading.min.css',
@@ -65,7 +65,7 @@ $GLOBALS['LEAFLET_LIBRARIES']['leaflet-loading'] = array
$GLOBALS['LEAFLET_LIBRARIES']['leaflet-fullscreen'] = array
(
'name' => 'Leaflet.Control.FullScreen',
'version' => '1.4.2',
'version' => '1.6.0',
'license' => '<a href="https://github.com/brunob/leaflet.fullscreen/blob/master/LICENSE" target="_blank">MIT</a>',
'homepage' => 'https://github.com/brunob/leaflet.fullscreen',
'css' => 'assets/leaflet/libs/leaflet-fullscreen/Control.FullScreen.min.css',
@@ -75,13 +75,42 @@ $GLOBALS['LEAFLET_LIBRARIES']['leaflet-fullscreen'] = array
$GLOBALS['LEAFLET_LIBRARIES']['leaflet-control-geocoder'] = array
(
'name' => 'Leaflet Control Geocoder',
'version' => '1.5.1',
'version' => '1.13.0',
'license' => '<a href="https://github.com/perliedman/leaflet-control-geocoder/blob/master/LICENSE" target="_blank">BSD-2-Clause</a>',
'homepage' => 'https://github.com/perliedman/leaflet-control-geocoder',
'css' => 'assets/leaflet/libs/control-geocoder/Control.Geocoder.min.css',
'javascript' => 'assets/leaflet/libs/control-geocoder/Control.Geocoder.min.js'
);
$GLOBALS['LEAFLET_LIBRARIES']['leaflet-extra-markers'] = array
(
'name' => 'Leaflet Extra Markers',
'version' => '1.2.1',
'license' => '<a href="https://github.com/coryasilva/Leaflet.ExtraMarkers/blob/master/LICENSE" target="_blank">MIT</a>',
'homepage' => 'https://github.com/coryasilva/Leaflet.ExtraMarkers',
'css' => 'assets/leaflet/libs/leaflet-extra-markers/css/leaflet.extra-markers.min.css',
'javascript' => 'assets/leaflet/libs/leaflet-extra-markers/js/leaflet.extra-markers.min.js'
);
$GLOBALS['LEAFLET_LIBRARIES']['leaflet-pm'] = array
(
'name' => 'leaflet.pm',
'version' => '0.25.0',
'license' => '<a href="https://github.com/codeofsumit/leaflet.pm/blob/develop/LICENSE" target="_blank">MIT</a>',
'homepage' => 'https://github.com/codeofsumit/leaflet.pm',
'css' => 'assets/leaflet/libs/leaflet-pm/leaflet.pm.css',
'javascript' => 'assets/leaflet/libs/leaflet-pm/leaflet.pm.min.js'
);
$GLOBALS['LEAFLET_LIBRARIES']['osmtogeojson'] = array
(
'name' => 'osmtogeojson',
'version' => '2.2.12',
'license' => '<a href="https://github.com/tyrasd/osmtogeojson/blob/gh-pages/LICENSE" target="_blank">MIT</a>',
'homepage' => 'https://github.com/tyrasd/osmtogeojson',
'javascript' => 'assets/leaflet/libs/osmtogeojson/osmtogeojson.js'
);
$GLOBALS['LEAFLET_LIBRARIES']['spin.js'] = array
(
'name' => 'spin.js',

View File

@@ -4,13 +4,12 @@
"description": "Libraries for Leaflet integration into Contao CMS =================================================",
"main": "gulpfile.js",
"dependencies": {
"del": "^2.2.2",
"gulp": "^3.9.1",
"gulp-minify-css": "^1.2.4",
"gulp-rename": "^1.2.2",
"gulp-replace": "^0.5.4",
"gulp-uglify": "^2.0.0",
"gulp-util": "^3.0.7",
"del": "^3.0.0",
"gulp": "^4.0.0",
"gulp-clean-css": "^3.10.0",
"gulp-rename": "^1.4.0",
"gulp-replace": "^1.0.0",
"gulp-uglify": "^3.0.0",
"merge-stream": "^1.0.0"
},
"devDependencies": {},