6

I'm trying to get zoom to work with the code from the Build an Account Geolocation App trailhead. I've passed and got my badge but I'm struggling to figure out how to handle zoom. I did wonder if it might be down to the Esri maps but after changing it to MapBox I had the same issue. What I want to do is make sure the markers remain in the correct place after zooming in or out of the map. They remain in the correct place when panning but stop in the exact same place in the UI when zooming.

This is the default map:

enter image description here

And after zooming out the Hyatt ends up in the drink:

enter image description here

For completeness sake, this is the code I tried with MapBox:

var map = L.map('map', {zoomControl: false}).setView([37.784173, -122.401557], 14);
L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}', {
    attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="http://mapbox.com">Mapbox</a>',
    maxZoom: 20,
    id: '<ID>',
    accessToken: '<TOKEN>'
}).addTo(map);
component.set("v.map", map);
  • Hi, are you still having the issue? How are you adding the markers to the map in the code? – Wookie88 Nov 20 '17 at 13:52
  • HI @Wookie88, I sort of gave it up - I used the code linked and got nowhere, maybe they've fixed it since then...? If you want to take a crack then grand :-) – annoyingmouse Nov 20 '17 at 17:34
  • It seems like some mistake in adding markers or with CSS of the map. I have recently been working on map in Lightning and Leaflet and everything was fine. Maybe they patched this. It will be hard to guess what could be wrong without details of your implementation. – Wookie88 Nov 21 '17 at 10:11
  • Thanks for looking @Wookie88, I'll take another look myself this afternoon. – annoyingmouse Nov 21 '17 at 11:40

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.