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

Limit bounds of Leaflet TileLayer #6

Open
banesullivan opened this issue May 1, 2023 · 0 comments
Open

Limit bounds of Leaflet TileLayer #6

banesullivan opened this issue May 1, 2023 · 0 comments

Comments

@banesullivan
Copy link
Contributor

We should be able to limit the bounds of the Leaflet TileLayer used in

This should look something like the following but I cannot get it to work. Ideally we should implement this as a prop on the widget

diff --git a/vue-components/src/components/LargeImageLTileLayer/script.js b/vue-components/src/components/LargeImageLTileLayer/script.js
index 174894f..28151b2 100644
--- a/vue-components/src/components/LargeImageLTileLayer/script.js
+++ b/vue-components/src/components/LargeImageLTileLayer/script.js
@@ -1,7 +1,7 @@
 import TileLayerMixin from 'vue2-leaflet/src/mixins/TileLayer.js';
 import Options from 'vue2-leaflet/src/mixins/Options.js';
 import { optionsMerger, propsBinder, findRealParent } from 'vue2-leaflet/src/utils/utils.js';
-import { tileLayer, DomEvent } from 'leaflet';
+import { tileLayer, DomEvent, LatLng } from 'leaflet';
 
 import 'leaflet/dist/leaflet.css';
 import { defineComponent } from 'vue';
@@ -25,6 +25,11 @@ export default defineComponent({
 
       // TODO: limit request bounds of the tileLayer
       const options = optionsMerger(this.tileLayerOptions, this);
+      options.bounds = [
+        new LatLng(45.846075214858075, -70.40894637677248),
+        new LatLng(40.07105681242268, -80.03236067899462),
+      ]
+      console.log(options)
       this.mapObject = this.tileLayerClass(url, options);
       DomEvent.on(this.mapObject, this.$listeners);
       propsBinder(this, this.mapObject, this.$options.props);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant