ArrayIndexOutOfBoundsException when creating graph with elevation

Using latest master and creating a graph for bike2 with elevation enabled and srtm provider.

This does not seem to work as I get the following exception during build:

Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
	at com.graphhopper.storage.RAMDataAccess.getShort(RAMDataAccess.java:255)
	at com.graphhopper.reader.dem.HeightTile.getHeight(HeightTile.java:101)
	at com.graphhopper.reader.dem.SRTMProvider.getEle(SRTMProvider.java:258)
	at com.graphhopper.reader.osm.OSMReader.getElevation(OSMReader.java:631)
	at com.graphhopper.reader.osm.OSMReader.addNode(OSMReader.java:616)
	at com.graphhopper.reader.osm.OSMReader.processNode(OSMReader.java:591)
	at com.graphhopper.reader.osm.OSMReader.writeOsm2Graph(OSMReader.java:300)
	... 5 more

Emux

Further testing, when I use cgiar for provider, then the graph creation completes successfully.

Emux

The data for the srtm provider are not downloaded now.

The reason for the fail seems to be the change from https to http in this commit here.

Reverting back to https the elevation data are retrieved correctly and the graph creation succeeds.

Emux

Thanks @devemux86 for the fix already! @boldtrn can you allow http again or should we use https :slight_smile: ?

@devemux86 @karussell

The whole kurviger.de namespace is forced to use https right now. I have just excluded the srtm subdomain. But I can only provide a self-signed certificate for this domain then. Does this work for you or should I enable the https enforcement again?

I retried with http and it works now.

BTW @karussell why not using https on GraphHopper following Kurviger’s default settings?

Emux

1 Like

Thanks for the fix @boldtrn !

Because it made problems at that time

@boldtrn self-signed won’t work with all JVMs I fear. Can’t you use one from https://letsencrypt.org/?

Edit: the cert does not seem to be self-signed when looking at it from the browser.

@karussell

Yes sorry, I disabled the “fix” since the JVM does not allow self-signed certificates. I can completely remove https for this domain?

Unfortunately not.

When I remove https, everyone using the mirror with https will be unable to use it. I am fine with both, let me know what you prefer.

Not sure I can follow. So as both, http and https are working fine now: which one should we use? Can we rely on http? And for https: why is the current setup not fine?

What we should fix: avoid this strange error if domain is not reachable and instead throw a proper exception, see https://github.com/graphhopper/graphhopper/issues/763

There are three options that I can provide for the srtm mirror:

  • https only
  • http only
  • http + self signed certificate

Unfortunately I cannot use letsencrypt. Right now I have reenabled https only. But I can setup any of the above options.

So what’s the suggested way to proceed, http or https?

Emux

So if https creates problems, I vote for using http only. Also elevation data is not really private, so there would be no security issue with not securing it. What do you think @karussell and @devemux86 ? However, switching to http will disrupt current users that use the srtm mirror at https.

I see that GraphHopper 0.7 uses Kurviger via https.

Emux

Yes, AFAIK there are some active users of the srtm mirror. So I can see some some issues switching to http.

Ok, thanks! So I’ve change from http to https … https://github.com/graphhopper/graphhopper/commit/33a268811aaae53358263503ad850506e1488669