Skip to content

Commit

Permalink
feat: max zoom defined at tile layer provider level via app-config
Browse files Browse the repository at this point in the history
  • Loading branch information
amoncaldas committed Dec 9, 2021
1 parent 817bd36 commit c3f5e4b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
14 changes: 8 additions & 6 deletions src/config-examples/app-config-example.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,45 +61,47 @@ const appConfig = {
visible: false,
attribution: '&copy; <a target="_blank" href="http://osm.org/copyright">OpenStreetMap</a> contributors',
url: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
token: null
maxZoom: 19
},
{
name: 'Satellite imagery',
id: 'world-imagery',
visible: false,
url: 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}',
attribution: 'Tiles &copy; Esri &mdash; Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community',
token: null
maxZoom: 17
},
{
name: 'Topography',
id: 'topography',
visible: false,
url: 'https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png',
attribution: 'Map data: &copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>, <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>)',
token: null
maxZoom: 18
},
{
name: 'Transport Dark',
id: 'transport-dark',
visible: false,
url: 'https://{s}.tile.thunderforest.com/transport-dark/{z}/{x}/{y}.png?apikey=13efc496ac0b486ea05691c820824f5f',
attribution: 'Maps &copy; <a href="http://thunderforest.com/">Thunderforest</a>, Data &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
token: null
maxZoom: 18
},
{
name: 'Outdoors',
id: 'outdoors',
visible: false,
url: 'https://{s}.tile.thunderforest.com/outdoors/{z}/{x}/{y}.png?apikey=13efc496ac0b486ea05691c820824f5f',
attribution: 'Maps &copy; <a href="http://thunderforest.com/">Thunderforest</a>, Data &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
attribution: 'Maps &copy; <a href="http://thunderforest.com/">Thunderforest</a>, Data &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
maxZoom: 18
},
{
name: 'Cyclosm',
id: 'cyclosm',
visible: false,
url: 'https://{s}.tile.openstreetmap.fr/cyclosm/{z}/{x}/{y}.png',
attribution: '<a href="https://github.com/cyclosm/cyclosm-cartocss-style/releases" title="CyclOSM - Open Bicycle render">CyclOSM</a> | Map data: &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
attribution: '<a href="https://github.com/cyclosm/cyclosm-cartocss-style/releases" title="CyclOSM - Open Bicycle render">CyclOSM</a> | Map data: &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
maxZoom: 18
}
],
wpsOverlayerTileProviders: []
Expand Down
9 changes: 8 additions & 1 deletion src/fragments/map-view/map-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -422,8 +422,15 @@ export default {
maxZoom () {
if (this.localMapViewData.maxZoom) {
return this.localMapViewData.maxZoom
} else {
let activeTileProvider = lodash.find(this.tileProviders, (t) => {
return t.id === this.$store.getters.mapSettings.defaultTilesProvider
})
if (activeTileProvider){
return activeTileProvider.maxZoom
}
return this.initialMaxZoom
}
return this.initialMaxZoom
},
/**
* Build and return the circle marker
Expand Down

0 comments on commit c3f5e4b

Please sign in to comment.