Example for setting up geocoding

I’ve set up the GraphHopper server on my home Linux. I got it up and running.
Now I’m trying to activate geocoding: I want to type in the address and have the system find the lat/lon. The documentation dances around the subject and drops hints here and there short of a clear explanation has one has to do to make it work.
I created an API key on the website.

I found the config file
1 const config = {
2 routingApi: location.origin + ‘/’,
3 geocodingApi: ‘xxxxxxxxxx’,
4 defaultTiles: ‘OpenStreetMap’,
5 keys: {
6 graphhopper: “xxxxxxxxxx”,
7 maptiler: “missing_api_key”,
8 omniscale: “missing_api_key”,
9 thunderforest: “missing_api_key”,
10 kurviger: “missing_api_key”
11 },
12 routingGraphLayerAllowed: true,
13 request: {
14 details: [
15 ‘road_class’,
16 ‘road_environment’,
17 ‘max_speed’,
18 ‘average_speed’,
19 ],
20 snapPreventions: [‘ferry’],
21 },
22 }

I’m guessing that the key should go into the “graphhopper” field??
What about the empty geocodingApi ‘’, what key is needed there? Same?
If somebody could share an example that would be great!


Try adding the same API key, i think i have done it in a similar fashion might work, if it doesn’t better read some documentation related to geocodingApi

If you read my question again:

  • I did read up on the documentation but couldn’t find a useful description of how to configure it, but perhaps you have some helpful documents you could point me to?
  • I thought my question pointed out that I already used my key in the config - there were marked “xxxxxxxxxx” because I don’t want to reveal the real one. Where should I put it otherwise?

It should be:

geocodingApi: 'https://graphhopper.com/api/1/',

and yes, for graphhopper you give it the API key of our hosted service. (the API key will be used for routingApi and geocodingApi. When you want to use local instances you will have to use location.origin).

1 Like

Is it enough to configure the field “geocodingApi” and the graphhopper key to enable the feature?
Or do I have to configure other things. I also used the photon.komoot.io/api URL to no avail.

You cannot use photon API directly. You will have to put our converter before it.

Is it enough to configure the field “geocodingApi” and the graphhopper key to enable the feature?

It should be enough, yes. But the config needs to go into the jar, i.e. you need to recreate the jar after every config change. Or use an external graphhopper maps.