Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Leaflet maxZoom to configParameters #7294

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- Add support for Cloud Optimised Geotiff (cog) in Cesium mode. Currently supports EPSG 4326 and 3857. There is experimental support for other projections but performance might suffer and there could be other issues.
- Fix `Workbench.collapseAll()` and `Workbench.expandAll()` for References.
- Add to the "doZoomTo" function the case of an imagery layer with imageryProvider.rectangle
- Add "leafletMaxZoom" to configParameters so that the maxZoom of the Leaflet viewer can be changed.
- [The next improvement]

#### 8.7.7 - 2024-10-01
Expand Down
1 change: 1 addition & 0 deletions lib/Models/Leaflet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ export default class Leaflet extends GlobeOrMap {
clippingRectangle: Rectangle | undefined
) => GridLayer = computedFn((ip, clippingRectangle) => {
const layerOptions = {
maxZoom: this.terria.configParameters.leafletMaxZoom,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think, because this is a map level config, it is better to pass it to the Map instance created here:

this.map = L.map(container, {
zoomControl: false,
attributionControl: false,
zoomSnap: 1, // Change to 0.2 for incremental zoom when Chrome fixes canvas scaling gaps
preferCanvas: true,
worldCopyJump: false
}).setView([-28.5, 135], 5);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, as you can read in the documentation of Leaflet (https://leafletjs.com/reference.html#map-maxzoom) the MapOptions.maxZoom property has no default limitations. The GridLayerOptions.maxZoom property is set to 18 by default, so it is the one to change so that zoom greater than 18 can be used.

bounds: clippingRectangle && rectangleToLatLngBounds(clippingRectangle)
};
// We have two different kinds of ImageryProviderLeaflet layers
Expand Down
4 changes: 4 additions & 0 deletions lib/Models/Terria.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,9 @@ export interface ConfigParameters {
*/
feedbackMinLength?: number;

/** If undefined, then Leaflet's default attribution will be used */
glughi marked this conversation as resolved.
Show resolved Hide resolved
leafletMaxZoom: number;

/** If undefined, then Leaflet's default attribution will be used */
leafletAttributionPrefix?: string;

Expand Down Expand Up @@ -574,6 +577,7 @@ export default class Terria {
feedbackPreamble: "translate#feedback.feedbackPreamble",
feedbackPostamble: undefined,
feedbackMinLength: 0,
leafletMaxZoom: 18,
leafletAttributionPrefix: undefined,
extraCreditLinks: [
// Default credit links (shown at the bottom of the Cesium map)
Expand Down