Restore (short) attribution on the map, closes #110
This commit is contained in:
parent
4740048960
commit
59827a524f
5 changed files with 56 additions and 26 deletions
|
|
@ -137,3 +137,5 @@ Copyright (c) 2012 Makina Corpus, [MIT License](https://github.com/makinacorpus/
|
||||||
Copyright (c) 2014 Dominik Moritz, [MIT License](https://github.com/domoritz/leaflet-locatecontrol/blob/gh-pages/LICENSE)
|
Copyright (c) 2014 Dominik Moritz, [MIT License](https://github.com/domoritz/leaflet-locatecontrol/blob/gh-pages/LICENSE)
|
||||||
* [Font Awesome](http://fontawesome.io/license/)
|
* [Font Awesome](http://fontawesome.io/license/)
|
||||||
by Dave Gandy; [SIL OFL 1.1](https://scripts.sil.org/OFL) (Font), MIT License (Code), CC BY 3.0 (Documentation)
|
by Dave Gandy; [SIL OFL 1.1](https://scripts.sil.org/OFL) (Font), MIT License (Code), CC BY 3.0 (Documentation)
|
||||||
|
* [Map BBCode](https://github.com/MapBBCode/mapbbcode)
|
||||||
|
Ilya Zverev; [Do What The F*ck You Want To Public License](https://github.com/MapBBCode/mapbbcode/blob/master/LICENSE)
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,8 @@
|
||||||
"bootstrap-select": "hugdx/bootstrap-select#patch-1",
|
"bootstrap-select": "hugdx/bootstrap-select#patch-1",
|
||||||
"leaflet-sidebar-v2": "nrenner/leaflet-sidebar-v2#dev",
|
"leaflet-sidebar-v2": "nrenner/leaflet-sidebar-v2#dev",
|
||||||
"leaflet.editable": "^1.1.0",
|
"leaflet.editable": "^1.1.0",
|
||||||
"codemirror": "^5.35.0"
|
"codemirror": "^5.35.0",
|
||||||
|
"mapbbcode": "MapBBCode/mapbbcode#v1.2.0"
|
||||||
},
|
},
|
||||||
"overrides": {
|
"overrides": {
|
||||||
"leaflet": {
|
"leaflet": {
|
||||||
|
|
@ -100,6 +101,9 @@
|
||||||
"jquery": "*",
|
"jquery": "*",
|
||||||
"bootstrap": "*"
|
"bootstrap": "*"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"mapbbcode": {
|
||||||
|
"main": "src/controls/PermalinkAttribution.js"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
|
|
|
||||||
24
index.html
24
index.html
|
|
@ -67,20 +67,36 @@
|
||||||
© <a target="_blank" href="https://www.openstreetmap.org/copyright">OpenStreetMap contributors</a>
|
© <a target="_blank" href="https://www.openstreetmap.org/copyright">OpenStreetMap contributors</a>
|
||||||
under <a target="_blank" href="https://opendatacommons.org/licenses/odbl/">ODbL</a>
|
under <a target="_blank" href="https://opendatacommons.org/licenses/odbl/">ODbL</a>
|
||||||
</dd>
|
</dd>
|
||||||
<dt>OpenstreetMap.de tiles</dt>
|
<dd>
|
||||||
<dd><a target="_blank" href="https://openstreetmap.de/karte.html">openstreetmap.de</a></dd>
|
Search by <a href="https://wiki.openstreetmap.org/wiki/Nominatim" target="_blank">Nominatim</a>
|
||||||
|
</dd>
|
||||||
|
<dt>OpenStreetMap tiles</dt>
|
||||||
|
<dd>
|
||||||
|
<a target="_blank" href="https://www.openstreetmap.org/copyright">openstreetmap.org</a>
|
||||||
|
under <a target="_blank" href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA 2.0</a>
|
||||||
|
</dd>
|
||||||
|
<dt>OpenStreetMap.de tiles</dt>
|
||||||
|
<dd>
|
||||||
|
<a target="_blank" href="https://openstreetmap.de/karte.html">openstreetmap.de</a>
|
||||||
|
</dd>
|
||||||
<dt>OpenTopoMap tiles</dt>
|
<dt>OpenTopoMap tiles</dt>
|
||||||
<dd>
|
<dd>
|
||||||
© <a target="_blank" href="https://opentopomap.org">OpenTopoMap</a>
|
© <a target="_blank" href="https://opentopomap.org">OpenTopoMap</a>
|
||||||
under <a target="_blank" href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a>
|
under <a target="_blank" href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a>
|
||||||
<a target="_blank" href="http://viewfinderpanoramas.org">SRTM</a>
|
<a target="_blank" href="http://viewfinderpanoramas.org">SRTM</a>
|
||||||
</dd>
|
</dd>
|
||||||
<dt>Thunderforest tiles</dt>
|
<dt>OpenCycleMap & Outdoors tiles</dt>
|
||||||
<dd>
|
<dd>
|
||||||
© <a target="_blank" href="https://www.thunderforest.com">Thunderforest</a>
|
© <a target="_blank" href="https://www.thunderforest.com">Thunderforest</a>
|
||||||
under <a target="_blank" href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA 2.0</a>
|
under <a target="_blank" href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA 2.0</a>
|
||||||
</dd>
|
</dd>
|
||||||
<dt>Waymarked Trails tiles</dt>
|
<dt>Esri World Imagery</dt>
|
||||||
|
<dd>
|
||||||
|
<a target="_blank" href="http://goto.arcgisonline.com/maps/World_Imagery">World Imagery</a>
|
||||||
|
© <a target="_blank" href="https://www.esri.com/">Esri</a>, sources:
|
||||||
|
Esri, DigitalGlobe, Earthstar Geographics, CNES/Airbus DS, GeoEye, USDA FSA, USGS, Getmapping, Aerogrid, IGN, IGP, and the GIS User Community
|
||||||
|
</dd>
|
||||||
|
<dt>Cycling & Hiking tiles</dt>
|
||||||
<dd>
|
<dd>
|
||||||
© <a target="_blank" href="https://cycling.waymarkedtrails.org">Waymarked Trails</a>
|
© <a target="_blank" href="https://cycling.waymarkedtrails.org">Waymarked Trails</a>
|
||||||
under <a target="_blank" href="https://creativecommons.org/licenses/by-sa/3.0/de/deed.en">CC-BY-SA 3.0 DE</a>
|
under <a target="_blank" href="https://creativecommons.org/licenses/by-sa/3.0/de/deed.en">CC-BY-SA 3.0 DE</a>
|
||||||
|
|
|
||||||
43
js/Map.js
43
js/Map.js
|
|
@ -8,50 +8,57 @@ BR.Map = {
|
||||||
|
|
||||||
var maxZoom = 19;
|
var maxZoom = 19;
|
||||||
|
|
||||||
|
// Layer attribution here only as short link to original site,
|
||||||
|
// to keep current position use placeholders: {zoom}/{lat}/{lon}
|
||||||
|
// Copyright attribution in index.html #credits
|
||||||
|
|
||||||
var osm = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
var osm = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||||
maxZoom: maxZoom
|
maxZoom: maxZoom,
|
||||||
|
attribution: '<a target="_blank" href="https://www.openstreetmap.org/#map={zoom}/{lat}/{lon}">OpenStreetMap</a>'
|
||||||
});
|
});
|
||||||
|
|
||||||
var osmde = L.tileLayer('https://{s}.tile.openstreetmap.de/tiles/osmde/{z}/{x}/{y}.png', {
|
var osmde = L.tileLayer('https://{s}.tile.openstreetmap.de/tiles/osmde/{z}/{x}/{y}.png', {
|
||||||
maxNativeZoom: 18,
|
maxNativeZoom: 18,
|
||||||
maxZoom: maxZoom
|
maxZoom: maxZoom,
|
||||||
|
attribution: '<a target="_blank" href="https://www.openstreetmap.de/karte.html?zoom={zoom}&lat={lat}&lon={lon}&layers=B000TF">OpenStreetMap.de</a>'
|
||||||
});
|
});
|
||||||
|
|
||||||
var topo = L.tileLayer('https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png', {
|
var topo = L.tileLayer('https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png', {
|
||||||
maxNativeZoom: 17,
|
maxNativeZoom: 17,
|
||||||
maxZoom: maxZoom
|
maxZoom: maxZoom,
|
||||||
|
attribution: '<a target="_blank" href="https://opentopomap.org/#map={zoom}/{lat}/{lon}">OpenTopoMap</a>'
|
||||||
});
|
});
|
||||||
|
|
||||||
var thunderforestAttribution = 'tiles © <a target="_blank" href="https://www.thunderforest.com">Thunderforest</a> '
|
|
||||||
+ '(<a target="_blank" href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA 2.0</a>)';
|
|
||||||
var thunderforestAuth = BR.keys.thunderforest ? '?apikey=' + BR.keys.thunderforest : '';
|
var thunderforestAuth = BR.keys.thunderforest ? '?apikey=' + BR.keys.thunderforest : '';
|
||||||
var cycle = L.tileLayer('https://{s}.tile.thunderforest.com/cycle/{z}/{x}/{y}.png' + thunderforestAuth, {
|
var cycle = L.tileLayer('https://{s}.tile.thunderforest.com/cycle/{z}/{x}/{y}.png' + thunderforestAuth, {
|
||||||
maxNativeZoom: 18,
|
maxNativeZoom: 18,
|
||||||
maxZoom: maxZoom
|
maxZoom: maxZoom,
|
||||||
|
attribution: '<a target="_blank" href="https://www.opencyclemap.org/?zoom={zoom}&lat={lat}&lon={lon}&layers=B0000">OpenCycleMap</a>'
|
||||||
});
|
});
|
||||||
var outdoors = L.tileLayer('https://{s}.tile.thunderforest.com/outdoors/{z}/{x}/{y}.png' + thunderforestAuth, {
|
var outdoors = L.tileLayer('https://{s}.tile.thunderforest.com/outdoors/{z}/{x}/{y}.png' + thunderforestAuth, {
|
||||||
maxNativeZoom: 18,
|
maxNativeZoom: 18,
|
||||||
maxZoom: maxZoom
|
maxZoom: maxZoom,
|
||||||
|
attribution: '<a target="_blank" href="https://www.opencyclemap.org/?zoom={zoom}&lat={lat}&lon={lon}&layers=000B0">Outdoors</a>'
|
||||||
});
|
});
|
||||||
|
|
||||||
var esri = L.tileLayer('https://{s}.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
|
var esri = L.tileLayer('https://{s}.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
|
||||||
maxNativeZoom: 19,
|
maxNativeZoom: 19,
|
||||||
maxZoom: maxZoom,
|
maxZoom: maxZoom,
|
||||||
subdomains: ['server', 'services'],
|
subdomains: ['server', 'services'],
|
||||||
attribution: '<a target="_blank" href="http://goto.arcgisonline.com/maps/World_Imagery">World Imagery</a> '
|
attribution: '<a target="_blank" href="http://www.arcgis.com/home/item.html?id=10df2279f9684e4a9f6a7f08febac2a9">Esri World Imagery</a>'
|
||||||
+ '© <a target="_blank" href="https://www.esri.com/">Esri</a>, sources: '
|
|
||||||
+ 'Esri, DigitalGlobe, Earthstar Geographics, CNES/Airbus DS, GeoEye, USDA FSA, USGS, Getmapping, Aerogrid, IGN, IGP, and the GIS User Community'
|
|
||||||
});
|
});
|
||||||
|
|
||||||
var cycling = L.tileLayer('https://tile.waymarkedtrails.org/cycling/{z}/{x}/{y}.png', {
|
var cycling = L.tileLayer('https://tile.waymarkedtrails.org/cycling/{z}/{x}/{y}.png', {
|
||||||
maxNativeZoom: 18,
|
maxNativeZoom: 18,
|
||||||
opacity: 0.7,
|
opacity: 0.7,
|
||||||
maxZoom: maxZoom
|
maxZoom: maxZoom,
|
||||||
|
attribution: '<a target="_blank" href="http://cycling.waymarkedtrails.org/#?map={zoom}!{lat}!{lon}">Cycling</a>'
|
||||||
});
|
});
|
||||||
var hiking = L.tileLayer('https://tile.waymarkedtrails.org/hiking/{z}/{x}/{y}.png', {
|
var hiking = L.tileLayer('https://tile.waymarkedtrails.org/hiking/{z}/{x}/{y}.png', {
|
||||||
maxNativeZoom: 18,
|
maxNativeZoom: 18,
|
||||||
opacity: 0.7,
|
opacity: 0.7,
|
||||||
maxZoom: maxZoom
|
maxZoom: maxZoom,
|
||||||
|
attribution: '<a target="_blank" href="http://hiking.waymarkedtrails.org/#?map={zoom}!{lat}!{lon}">Hiking</a>'
|
||||||
});
|
});
|
||||||
|
|
||||||
map = new L.Map('map', {
|
map = new L.Map('map', {
|
||||||
|
|
@ -60,9 +67,17 @@ BR.Map = {
|
||||||
if (!map.restoreView()) {
|
if (!map.restoreView()) {
|
||||||
map.setView([50.99, 9.86], 6);
|
map.setView([50.99, 9.86], 6);
|
||||||
}
|
}
|
||||||
map.attributionControl.setPrefix(false);
|
|
||||||
map.attributionControl.addAttribution('<a href="" data-toggle="modal" data-target="#credits">Copyright & credits</a>')
|
|
||||||
|
|
||||||
|
// two attribution lines by adding two controls, prevents ugly wrapping on
|
||||||
|
// small screens, better separates static from layer-specific attribution
|
||||||
|
map.attributionControl.setPrefix(
|
||||||
|
'© <a target="_blank" href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>' +
|
||||||
|
($(map.getContainer()).outerWidth() >= 400 ? ' contributers' : '') +
|
||||||
|
' · <a href="" data-toggle="modal" data-target="#credits">Copyright</a>' +
|
||||||
|
' · <a target="_blank" href="http://brouter.de/privacypolicy.html">Privacy</a>');
|
||||||
|
|
||||||
|
new L.Control.PermalinkAttribution().addTo(map);
|
||||||
|
map.attributionControl.setPrefix(false);
|
||||||
|
|
||||||
var baseLayers = {
|
var baseLayers = {
|
||||||
'OpenStreetMap': osm,
|
'OpenStreetMap': osm,
|
||||||
|
|
|
||||||
|
|
@ -6,13 +6,6 @@ BR.Search = L.Control.Geocoder.extend({
|
||||||
position: 'topleft'
|
position: 'topleft'
|
||||||
},
|
},
|
||||||
|
|
||||||
onAdd: function (map) {
|
|
||||||
map.attributionControl.addAttribution(
|
|
||||||
'search by <a href="https://wiki.openstreetmap.org/wiki/Nominatim" target="_blank">Nominatim</a>');
|
|
||||||
|
|
||||||
return L.Control.Geocoder.prototype.onAdd.call(this, map);
|
|
||||||
},
|
|
||||||
|
|
||||||
markGeocode: function(result) {
|
markGeocode: function(result) {
|
||||||
this._map.fitBounds(result.geocode.bbox, {
|
this._map.fitBounds(result.geocode.bbox, {
|
||||||
maxZoom: 17
|
maxZoom: 17
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue