Leaflet: Geocoding

02 March 2019

I added the possibility to search a place a jump the map to the find location. I used the leaflet-control-geocoder plugin.

Easy to handle. Load source and use it.

Only problem is that when you search I got a Marker with a popup on the found location which I do not want (maybe in future but right now not). I could not figure it out how to remove it. The author explain a bit but could not use it really. I then took example from map2gpx and checked in the code to find out how it was done.

L.Control.geocoder({
  position: 'topleft',
  expand: 'click',
  defaultMarkGeocode: false
}).on('markgeocode', function(e) {
  map.setView(e.geocode.center, 11
); }).addTo(map);


Comments

    Join the discussion for this article on this ticket. Comments appear on this page instantly.
    Thanks to aristaht for making this static comment system possible.