Closed Coroico closed 9 years ago
This seems like it could be a useful feature! Could you please provide a pull request where you have implemented the change along with a demo page to show off how you would use it in practice?
:thumbsup:
For the demo look at this page : http://bdvllrd.o2switch.net/eurovelo3/wpdev/tests/minimap-2.html Change the map layer to see how the minimap change.
I am a leaflet newbie so may be this is not the better implementation:
map.on('baselayerchange', function(e) {
// if needed update minimap
if (e.name != iLayer){
minimap.changeLayer(baseminimap[e.name]);
}
iLayer = e.name;
});
Hello you two,
I've got a map with minimap code here: http://gis.stackexchange.com/questions/124996/minimap-in-leaflet/125111#125111
I've got some baselayers that I would like to see changing in Minimap as the baselayer changes. But first problem is that minimap doesn't show a map at all.
Any suggestions how to fix that problem? thanks a lot!
@hoge6b01, I answered on the StackExchange post. Be a darling and accept the answer. :heavy_check_mark:
@robpvn Thank you so much. I'll accept the answer. What about the minimap showing the same baselayer as the real basemap?
I tried Coroico's code but I am sure I did something wrong. All I got was a blank miniMap. Do you have any suggestions? Thanks
I don't have any suggestions when you don't give any details or show any code. Try making a JSFiddle with your code, remove everything that isn't related to your problem and showing us that. You might even fix the problem yourself while you do that work!
Sorry, you're right. I updated the JSFiddle with my last code I tried to use. Would be great if you find any suggestion. http://jsfiddle.net/y4z9e9os/5/
Your main problem was that @Coroico's code isn't in the plugin yet, so it needed to be added, secondly that you were using the other code wrong. I forked the fiddle and fixed it for you: http://jsfiddle.net/hk9f5dq0/
Now that I've taken the time to look at this properly, I might go ahead and add the relevant code into the plugin to make this easier in the future.
as new feature, I added a changeLayer method to manage the change of the minimap layer when the main map layer change: