I need to change start zoom and centering of the map

Hello. I started using Graphhopper Maps. I need to change start zoom and centering map. Is there any way to do that?

thanks in advance!!


The code is here: https://github.com/graphhopper/graphhopper-maps/blob/b57a2844e643fc03a28f9a148b3b2f5b599cf14c/src/map/map.ts#L16-L17


could you tell me, can i do that thing using graphhopper web?

The easiest you can do is run the maps app separately and point it to a GraphHopper server: GitHub - graphhopper/graphhopper-maps: GraphHopper Maps - Open Source Route Planner UI
Then your changes in the maps code will become visible.

I dont know. Changes on this lines https://github.com/graphhopper/graphhopper-maps/blob/b57a2844e643fc03a28f9a148b3b2f5b599cf14c/src/map/map.ts#L16-L17 not help me. I using custom pbf map. What should i do for that?

You need to:

  1. Start the GraphHopper server as explained in the GraphHopper server readme, by default it will run on port 8989
  2. Start the GraphHopper maps app as explained in the GraphHopper maps readme and point it to your local GraphHopper server on port 8989. The maps app will run on port 3000 by default.
  3. Now you can modify the maps app as you need.

Maybe I didn’t explain what I need correctly. I need to set the default scale and location of the map

You can change the scale and the location with the lines of code I linked above.

1 Like