Using locally-compiled graphhopper-web with locally-compiled graphhopper-maps

Hi all. I have forked and compiled both graphhopper and graphhopper-maps to make some minor edits for a custom set-up I’m making. I have successfully edited and compiled the changes I’d like to both (graphhopper: use traffic speed data I have access to, graphhopper-maps: add our in-house backdrop mapping). My problem is that I can’t get the two to work together.

Here is what I have done so far:

I’ve added the backdrop maps I needed, which was pretty straightforward. When I run npm run serve and go to localhost:3000 I see the desired changes. I have then run npm run build.

I have added a .npmignore containing the following:


(This was required to get /dist and config.js to be included in the packing during graphhopper-web-bundle compile)

In web-bundle/pom.xml I have replaced the section

  <id>download graphhopper maps<\id>

with the following

  <id>download graphhopper maps</id>
      pack --pack-destination=${basedir}/target

and also replaced the section

  <id>unzip maps bundle<\id>

with the following

  <id>unzip maps bundle</id>
      <untar compression="gzip"
          <include name="package/dist/**"/>
        <mapper type="regexp" from="package\/dist\/(.*)" to="\1"/>

When I do a mvn clean install of graphhopper, I can see that my version of graphhopper-maps gets compressed to web-bundle/target/graphhopper-maps-0.7.tgz as expected, but then when I use the compiled graphhopper-web.jar (which I believe includes web-bundle…?) to start the GraphHopper server, it is still using the “default” version of graphhopper-web, i.e. without the backdrop map options I’ve added.

I can’t find any other reference among the poms pointing to the remote version of graphhopper-maps so I’m very confused why I’m not seeing my local edited version of graphhopper-maps as part of graphhopper-web.

Any pointers on what I’m missing would be gratefully received. I’m new to both Java and JavaScript so very aware that I might not be understanding how the dependencies are working.


Well, the easiest you can do is simply start your modified GraphHoppper Maps app as a separate process and make it use your custom GraphHopper server as backend by setting the local url in your config-local.js file. But you would rather like to include the modified maps app in the GraphHopper server jar?

Hi easbar. Thanks, yes, I think that was what I was going to do if I couldn’t find a neater solution, but ideally I’d like to have a set-up which is as easy to initialise as the “out of the box” GraphHopper is, because it’s going to be run by different colleagues on different local systems…

First thing I would do is making absolutely sure that your browser is not caching the old version (reload the page, clear the cache, use a private window etc.). Next thing I would do is opening the jar (it is just a zip archive) to make sure your modified JavaScript files ended up at the correct location.

graphhopper-web.jar (which I believe includes web-bundle…?)

Yes, web/target/graphhopper-web-9.0-SNAPSHOT.jar is a super-jar that includes the web-bundle jar.

Hi easbar. Thank you. You were right that it was my browser caching an old version… Rookie error! Thanks so much for your help!

Glad to hear you made it work. Btw can you share any details about how you are using traffic with GraphHopper? Usually it is a challenge to find the OSM ways / GH edges that correspond to the given traffic information.

Hi easbar, sorry I somehow missed your last question!

I’m actually not using OSM data, I’m using an in-house network dataset for which we already have traffic speed information

Ok thanks!

I’m looking to make changes to graphhopper-maps and graphhopper. Just trying to confirm how to bundle both together and test. Is this documented anywhere? Thanks!

I think you already came to the right place, did you try @tompeterken-os solution above?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.