0

I am about to combine more than 1 map. This is kind of sync, but is not particular sync as shown in the following example:

https://github.com/jieter/Leaflet.Sync

Basically my goal is to get instant permalink from another website in my leaflet map. A good example is the Leaflet Street View plugin:

https://github.com/Zverik/leaflet-streetview

where through the button you can instantly incorporate the view (under coordinates given) from i.e Google Street View.

Once I incorporated permalink to my website:

Leaflet map with coordinates included in the URL path

I would love to get a link to the same coordinates in another URL permalink likewise: from my leaflet map permalink http://localhost/fl/MDU%20map%20v1.0/#52.28673,0.18075,13z link to the: https://www.suncalc.org/#/52.3929,-1.4583,6/2019.10.18/11:16/1/0 for example suncalc permalink

https://www.peakfinder.org/?lat=52.2898&lng=0.1698&azi=181&zoom=5&ele=6&cfg=rs&date=2019-10-18T10:17Z

or Peakfinder permalink.

Analyzing the Leaflet Street View plugin code, I found:

 providers: [
['google', '<b>Street View</b>', 'Google Street View', false,
  'https://www.google.com/maps?layer=c&cbll={lat},{lon}'],

  onAdd: function(map) {
    this._container = L.DomUtil.create('div', 'leaflet-bar');
    this._buttons = [];

I was trying to do sth like this:

 providers: [
['suncalc','<b>Suncalc</b>', 'Suncalc tool',
 'https://www.suncalc.org/?layer=c&cbll={lat},{lon}'],

but it doesn't work.

Console says:

Uncaught TypeError: b._bounds.contains is not a function at i._update (StreetViewButtons.js:125) at i.onAdd (StreetViewButtons.js:44) at i.addTo (leaflet.js:5) at (index):311

what mostly refers to the LeafletStreetViewbuttons.js

line44: this._update(map.getCenter());

and line 125: show = !b._bounds || b._bounds.contains(center);

One of the working example is here:

http://xjubier.free.fr/en/site_pages/solar_eclipses/TSE_2019_GoogleMapFull.html?Lat=-32.39440&Lng=-64.54766&Zoom=3&LC=1

where clicking on the MAX value in popup window, you are being redirected to the specified coordinates included in the Peakfinder permalink

Is it possible for leaflet maps?

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.