Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
kappu committed Sep 11, 2017
1 parent 60015c8 commit aa17ef1
Show file tree
Hide file tree
Showing 10 changed files with 88 additions and 25 deletions.
2 changes: 1 addition & 1 deletion web/client/components/map/leaflet/Map.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class LeafletMap extends React.Component {
doubleClickZoom: false,
boxZoom: false,
tap: false
}, this.props.mapOptions, this.crs ? {crs: this.crs} : {});
}, {maxZoom: 23}, this.props.mapOptions, this.crs ? {crs: this.crs} : {});

const map = L.map(this.props.id, assign({zoomControl: this.props.zoomControl}, mapOptions) ).setView([this.props.center.y, this.props.center.x],
Math.round(this.props.zoom));
Expand Down
4 changes: 3 additions & 1 deletion web/client/components/map/leaflet/plugins/BingLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ Layers.registerType('bing', {
type: options.name,
attribution: 'Bing',
culture: '',
onError: options.onError
onError: options.onError,
maxNativeZoom: options.maxNativeZoom || 19,
maxZoom: options.maxZoom || 23
};
if (options.zoomOffset) {
layerOptions = assign({}, layerOptions, {
Expand Down
7 changes: 5 additions & 2 deletions web/client/components/map/leaflet/plugins/GoogleLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@

var Layers = require('../../../../utils/leaflet/Layers');
var Google = require('leaflet-plugins/layer/tile/Google');

Google.prototype._checkZoomLevels = function() {
// Avoid map zoom setting when current zoom is greatr then the google's max zoom
};
Layers.registerType('google', (options) => {
return new Google(options.name, {zoomOffset: options.zoomOffset || 0});
return new Google(options.name, {zoomOffset: options.zoomOffset || 0, maxNativeZoom: options.maxNativeZoom || 18,
maxZoom: options.maxZoom || 20});
});
3 changes: 2 additions & 1 deletion web/client/components/map/leaflet/plugins/MapQuest.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ const MQ = require('../../../../libs/mapquest');
Layers.registerType('mapquest', {
create: (options) => {
if (MQ) {
return MQ.mapLayer(options);
return MQ.mapLayer({
maxZoom: 23, ...options});
}
if (options && options.onError) {
options.onError();
Expand Down
4 changes: 3 additions & 1 deletion web/client/components/map/leaflet/plugins/OSMLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ var L = require('leaflet');
Layers.registerType('osm', (options) => {
return L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors',
zoomOffset: options.zoomOffset || 0
zoomOffset: options.zoomOffset || 0,
maxNativeZoom: options.maxNativeZoom || 19,
maxZoom: options.maxZoom || 23
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ var L = require('leaflet');
var TileProvider = require('../../../../utils/TileConfigProvider');

Layers.registerType('tileprovider', (options) => {
let [url, opt] = TileProvider.getLayerConfig(options.provider, options);
let [url, opt] = TileProvider.getLayerConfig(options.provider, {maxZoom: 23, ...options});
return L.tileLayer(url, opt);
});
9 changes: 4 additions & 5 deletions web/client/components/map/leaflet/plugins/WMSLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,12 @@ L.TileLayer.MultipleUrlWMS = L.TileLayer.WMS.extend({
} else {
wmsParams.width = wmsParams.height = tileSize;
}

for (let i in options) {
// all keys that are not TileLayer options go to WMS params
if (!this.options.hasOwnProperty(i) && i.toUpperCase() !== 'CRS') {
if (!this.options.hasOwnProperty(i) && i.toUpperCase() !== 'CRS' && i !== "maxNativeZoom") {
wmsParams[i] = options[i];
}
}

this.wmsParams = wmsParams;

L.setOptions(this, options);
Expand Down Expand Up @@ -83,9 +81,10 @@ function wmsToLeafletOptions(options) {
version: options.version || "1.3.0",
SRS: CoordinatesUtils.normalizeSRS(options.srs || 'EPSG:3857', options.allowedSRS),
CRS: CoordinatesUtils.normalizeSRS(options.srs || 'EPSG:3857', options.allowedSRS),
tileSize: options.tileSize || 256
tileSize: options.tileSize || 256,
maxZoom: options.maxZoom || 23,
maxNativeZoom: options.maxNativeZoom || 18
}, objectAssign(
{},
(options._v_ ? {_v_: options._v_} : {}),
(options.params || {})
));
Expand Down
4 changes: 3 additions & 1 deletion web/client/components/map/leaflet/plugins/WMTSLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ function wmtsToLeafletOptions(options) {
tileMatrixSet: tileMatrixSet,
version: options.version || "1.0.0",
tileSize: options.tileSize || 256,
CRS: CoordinatesUtils.normalizeSRS(options.srs || 'EPSG:3857', options.allowedSRS)
CRS: CoordinatesUtils.normalizeSRS(options.srs || 'EPSG:3857', options.allowedSRS),
maxZoom: options.maxZoom || 23,
maxNativeZoom: options.maxNativeZoom || 18
}, options.params || {});
}

Expand Down
Loading

0 comments on commit aa17ef1

Please sign in to comment.