Set layer bounds to avoid unnecessary tile requests (404 errors) (#146)
Add new 'worldTiles' flag where coverage is limited, but basic worldwide tiles are provided.
This commit is contained in:
parent
e049dbf42a
commit
0e0619f5da
1 changed files with 24 additions and 12 deletions
|
|
@ -170,47 +170,57 @@ BR.LayersConfig = L.Class.extend({
|
||||||
'mapUrl': 'http://maps.sputnik.ru/?lat={lat}&lng={lon}&zoom={zoom}'
|
'mapUrl': 'http://maps.sputnik.ru/?lat={lat}&lng={lon}&zoom={zoom}'
|
||||||
},
|
},
|
||||||
'MtbMap': {
|
'MtbMap': {
|
||||||
'mapUrl': 'http://mtbmap.cz/#zoom={zoom}&lat={lat}&lon={lon}'
|
'mapUrl': 'http://mtbmap.cz/#zoom={zoom}&lat={lat}&lon={lon}',
|
||||||
|
'worldTiles': true // -z12
|
||||||
},
|
},
|
||||||
// MRI (maps.refuges.info)
|
// MRI (maps.refuges.info)
|
||||||
'1069': {
|
'1069': {
|
||||||
'nameShort': 'Refuges.info',
|
'nameShort': 'Refuges.info',
|
||||||
'mapUrl': 'http://maps.refuges.info/?zoom={zoom}&lat={lat}&lon={lon}&layers=B'
|
'mapUrl': 'http://maps.refuges.info/?zoom={zoom}&lat={lat}&lon={lon}&layers=B',
|
||||||
|
'worldTiles': true
|
||||||
},
|
},
|
||||||
'osmfr-basque': {
|
'osmfr-basque': {
|
||||||
'language_code': 'eu',
|
'language_code': 'eu',
|
||||||
'nameShort': 'OSM Basque',
|
'nameShort': 'OSM Basque',
|
||||||
'mapUrl': 'http://tile.openstreetmap.fr/?layers=00000000BFFFFFF&zoom={zoom}&lat={lat}&lon={lon}'
|
'mapUrl': 'http://tile.openstreetmap.fr/?layers=00000000BFFFFFF&zoom={zoom}&lat={lat}&lon={lon}',
|
||||||
|
'worldTiles': true
|
||||||
},
|
},
|
||||||
'osmfr-breton': {
|
'osmfr-breton': {
|
||||||
'language_code': 'br',
|
'language_code': 'br',
|
||||||
'nameShort': 'OSM Breton',
|
'nameShort': 'OSM Breton',
|
||||||
'mapUrl': 'https://kartenn.openstreetmap.bzh/#map={zoom}/{lat}/{lon}'
|
'mapUrl': 'https://kartenn.openstreetmap.bzh/#map={zoom}/{lat}/{lon}',
|
||||||
|
'worldTiles': true
|
||||||
},
|
},
|
||||||
'osmfr-occitan': {
|
'osmfr-occitan': {
|
||||||
'language_code': 'oc',
|
'language_code': 'oc',
|
||||||
'nameShort': 'OSM Occitan',
|
'nameShort': 'OSM Occitan',
|
||||||
'mapUrl': 'http://tile.openstreetmap.fr/?layers=0000000B0FFFFFF&zoom={zoom}&lat={lat}&lon={lon}'
|
'mapUrl': 'http://tile.openstreetmap.fr/?layers=0000000B0FFFFFF&zoom={zoom}&lat={lat}&lon={lon}',
|
||||||
|
'worldTiles': true
|
||||||
},
|
},
|
||||||
'osmbe': {
|
'osmbe': {
|
||||||
'nameShort': 'OSM Belgium',
|
'nameShort': 'OSM Belgium',
|
||||||
'mapUrl': 'https://tile.osm.be/#map={zoom}/{lat}/{lon}'
|
'mapUrl': 'https://tile.osm.be/#map={zoom}/{lat}/{lon}',
|
||||||
|
'worldTiles': true // -z7
|
||||||
},
|
},
|
||||||
'osmbe-fr': {
|
'osmbe-fr': {
|
||||||
'nameShort': 'OSM Belgium (fr)',
|
'nameShort': 'OSM Belgium (fr)',
|
||||||
'mapUrl': 'https://tile.osm.be/#map={zoom}/{lat}/{lon}'
|
'mapUrl': 'https://tile.osm.be/#map={zoom}/{lat}/{lon}',
|
||||||
|
'worldTiles': true // -z7
|
||||||
},
|
},
|
||||||
'osmbe-nl': {
|
'osmbe-nl': {
|
||||||
'nameShort': 'OSM Belgium (nl)',
|
'nameShort': 'OSM Belgium (nl)',
|
||||||
'mapUrl': 'https://tile.osm.be/#map={zoom}/{lat}/{lon}'
|
'mapUrl': 'https://tile.osm.be/#map={zoom}/{lat}/{lon}',
|
||||||
|
'worldTiles': true // -z7
|
||||||
},
|
},
|
||||||
'OpenStreetMap.CH': {
|
'OpenStreetMap.CH': {
|
||||||
'country_code': 'CH',
|
'country_code': 'CH',
|
||||||
'mapUrl': 'https://osm.ch/#{zoom}/{lat}/{lon}'
|
'mapUrl': 'https://osm.ch/#{zoom}/{lat}/{lon}',
|
||||||
|
'worldTiles': true
|
||||||
},
|
},
|
||||||
'topplus-open': {
|
'topplus-open': {
|
||||||
'country_code': 'DE',
|
'country_code': 'DE',
|
||||||
'mapUrl': 'http://www.geodatenzentrum.de/geodaten/gdz_rahmen.gdz_div?gdz_spr=deu&gdz_user_id=0&gdz_akt_zeile=5&gdz_anz_zeile=1&gdz_unt_zeile=41'
|
'mapUrl': 'http://www.geodatenzentrum.de/geodaten/gdz_rahmen.gdz_div?gdz_spr=deu&gdz_user_id=0&gdz_akt_zeile=5&gdz_anz_zeile=1&gdz_unt_zeile=41',
|
||||||
|
'worldTiles': true // World -z9, Europe -z14
|
||||||
},
|
},
|
||||||
|
|
||||||
'OpenStreetMap-turistautak': {
|
'OpenStreetMap-turistautak': {
|
||||||
|
|
@ -238,7 +248,8 @@ BR.LayersConfig = L.Class.extend({
|
||||||
'osm-cambodia_laos_thailand_vietnam-bilingual': {
|
'osm-cambodia_laos_thailand_vietnam-bilingual': {
|
||||||
'country_code': 'TH+',
|
'country_code': 'TH+',
|
||||||
'nameShort': 'Thaimap',
|
'nameShort': 'Thaimap',
|
||||||
'mapUrl': 'http://thaimap.osm-tools.org/?zoom={zoom}&lat={lat}&lon={lon}&layers=BT'
|
'mapUrl': 'http://thaimap.osm-tools.org/?zoom={zoom}&lat={lat}&lon={lon}&layers=BT',
|
||||||
|
'worldTiles': true
|
||||||
},
|
},
|
||||||
'HikeBike.HillShading': {
|
'HikeBike.HillShading': {
|
||||||
'name': i18next.t('map.layer.hikebike-hillshading'),
|
'name': i18next.t('map.layer.hikebike-hillshading'),
|
||||||
|
|
@ -1871,7 +1882,8 @@ BR.LayersConfig = L.Class.extend({
|
||||||
|
|
||||||
|
|
||||||
var options = {
|
var options = {
|
||||||
maxZoom: this._map.getMaxZoom()
|
maxZoom: this._map.getMaxZoom(),
|
||||||
|
bounds: layerData.geometry && !props.worldTiles ? L.geoJson(layerData.geometry).getBounds() : null
|
||||||
};
|
};
|
||||||
if (props.mapUrl) {
|
if (props.mapUrl) {
|
||||||
options.mapLink = '<a target="_blank" href="' + props.mapUrl + '">' + (props.nameShort || props.name) + '</a>';
|
options.mapLink = '<a target="_blank" href="' + props.mapUrl + '">' + (props.nameShort || props.name) + '</a>';
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue