1
votes

I recently added Mapbox's Geocoder Control and it works wonderfully. I was wondering if anyone could tell me how I could have a marker appear at the location of the address that was searched for? Below is the code I'm currently using for the control.

.addControl(L.mapbox.geocoderControl('mapbox.places', {
    position: 'topright',
    keepOpen: false,
    autocomplete: false
}))
1

1 Answers

0
votes

Basically you have to register a listener for select event:

geocoder_control.on('select', function(object){
    var coord = object.feature.geometry.coordinates;

    //create and add your marker
});

I've made an example for you:

http://plnkr.co/edit/joOXJ6?p=preview