-3

I am currently researching for Geocoding Tool vendors and also came across mapbox. I created an account and now I am trying to set up the Geocode with this tutorial webpage:

https://docs.mapbox.com/help/tutorials/local-search-geocoding-api/

It´s going well but as I come to the "add the geocoder" part, I don´t understand it no more.

(the original text from it, that can also be viewed following the link: The next step is to add a geocoder using the Mapbox GL JS Geocoder plugin. To do this, first you need to add links to the geocoder's JavaScript and CSS to the head of the HTML file.)

It says that I have to add a geocoder using the Mapbox GL JS Geocoder plugin. But which Geocoder is meant with that? Is that a different application and where do I get that one from? And how can I add the links to the Geocoder´s Javascript then? And it also says something about CSS and the head of the HTML file. Does that refer to the HTML document where I initialized the map and put the marker in or to the CSS / geocoder?

Can someone give me some advice concering that? I am really looking forward to your answers :)

Greetings, Tobias Kink

1 Answers1

0

here is the link to geocoder plugins github. You need to create geocoder instance and add it to map as a control, like so.

const geocoder = new MapboxGeocoder({
    accessToken: mapboxgl.accessToken,
    mapboxgl: mapboxgl
});
map.addControl(geocoder);

Please take a look at the repo for more info. Mapbox is great, hope you'll get used to it fast, take care.

Narek Gevorgyan
  • 113
  • 1
  • 12