Repository navigation
Remove handling of node tag "ele" - #2230
Conversation
Co-authored-by: Thomas Butz <[email protected]>
# Conflicts: # core/src/main/java/com/graphhopper/reader/ReaderNode.java
|
Hi @easbar, @otbutz, @karussell, We were relying on this hidden feature in our project. Here is how and why it could become more and more common usecase for other graphhopper users. The normal way of adding elevation in graphhopper is to use 2d raster sources like SRTM. It is straightforward and great but has drawbacks in the context of bridges or tunnels because the elevation will be taken from the terrain instead of the road network itself. As a consequence the resulting network will go down in the rivers or go up above the mountains, making any routing based on relief moot. So we created our own OSM files with proper elevation on each node, and gave that to graphhopper, configured with a special provider and a small hack. It worked very well. The road network and elevation we used at that time was "proprietary", but it is freely available now thanks to the trend of governments publishing opendata. So I am pretty sure there will be more and more demand of this kind of high quality routing and having it in standard in Graphhopper would be certainly attractive for more and more users. We will invest the necessary time to restore that functionnality and maintain it in our branch. But we can as well do the work upstream if you think it would be valuable for Graphhopper. |
|
I would rather prefer a dedicated elevation provider which is able to handle street level data to be honest. The current implementations are all tile based and if we really want to add support for this, we should do it in a clean and extensible way. If we want to support it upstream, the following points are IMHO important:
|
No, this is not the case. See: #798 and it is independent of the FlagEncoder since a few releases |
|
Thanks for describing your use case. I also think that there should be a way to integrate elevation data on the street level with GraphHopper. But I rather think it should be treated as a separate data resource so it won't be necessary to manipulate the OSM file. There are no official plans of adding elevation data to every OSM (street) node, right? @gberaudo Do you use the OSM road network and attached elevation data to this? And if yes, how does this work? I mean assuming you have a separate data source containing elevation data, how did you match this to the OSM nodes? Is there a freely available example of this data? Or do you use a separate road network that already includes elevation data and you just converted this to the OSM format so you can feed it to GraphHopper's OSMReader? |
|
Thank you @otbutz, @karussell, @easbar for your quick replies. Indeed, from a user perspective, I see 2 really different use cases related to elevation:
@karussell, I was not aware of the intelligent bridget/tunnel interpolation capability of Graphhopper. It is interesting. The Swiss federation also publishes very precise DEM rasters as open data, which could probably give interesting results. However, the most precise dataset is around 1 terabytes, which may be challenging to use. The federation also publishes a road network where all coordinates are already in 3D. @easbar, we convert that to the OSM format, keeping the elevation of each node. Then Graphhopper simply reads elevation from the nodes. It is very convenient because we are relying on the OSM standard and there are many tools to handle it. @otbutz, woudn't it be possible to stick with the OSM standard and simply expose a config option? would it cause a performance issue? |
Strictly speaking, we would not follow the OSM standard, but only the OSM pbf file format. The usage of the
|
|
@otbutz, thanks I overlooked that information. So here is the situation as I understand it:
I looked at existing formats but could not find one. @otbutz, do you have some idea? |
OSM: height over the mean sea level (orthometric height)
Our current tilebased provider implementations are doing their lookup based on lat/lon:
You might want to check if OpenLR would work for this usecase: https://www.openlr-association.com/method.html It's opensource, has a compatible license, a Java implementation exists and is designed to augment one map dataset with values from a different one. |
|
Regarding the height reference. Do you mean users should only use Graphhopper with ellipsoid heights only?
This method may be interesting to add elevation from a precise "map" to a map from OpenStreetMap data. Question: should it be part of Graphhopper or of an independant preprocessing tool? The later would offer the larger possibilities (nut just handling elevation) and avoid having to maintain the functionnality in Graphhopper; but we would be back to the initial use case: supporting OSM data with ele tag. |
Yes, I understand. In one case we can provide an elevation source that returns elevation data given a lat,lon pair and in the other case we explicitly provide elevation data for every OSM (highway) node. I imagine there could even be a combination of both. For example GraphHopper supports elevation interpolation where additional helper nodes are created to maintain elevation details (see #1953). This requires the first kind of elevation source, but could be useful also when we use the second. Or, alternatively, such interpolation is done beforehand. Anyway, I think both use cases should be supported by GraphHopper and at the very least they should be possible with minor adjustments when they are needed. Since the first kind is already supported via And @gberaudo isn't it almost trivial to do this already with the current OSMReader? It looks like all you need to do is get whatever tag you use (can be graphhopper/core/src/main/java/com/graphhopper/reader/osm/OSMReader.java Lines 495 to 504 in 8243cf2 It might be as simple as this: // double ele = eleProvider.getEle(lat, lon);
double ele = node.getTag("my_ele", myDefaultValueInCaseTheMyEleTagIsMissing); |
|
Is the mapping even done by OSM ID? e.g the road network link provided by @gberaudo seems to be a regular ESRI shapefile. I think we still need to lookup elevation based on lat/lon. The difference for me is that instead of a tilebased approach we would have something like the LocationIndex which would lookup the nearest line/point with elevation data. |
|
No, as far as I understood @gberaudo has a complete road network (including elevation for all nodes) and converts this to the OSM format so it can be read by GraphHopper (I think a very reasonable approach). |
|
@otbutz, the lines in the shapefile are 3D; the resulting osm.pbf have an elevation for every node. Since all the data is in the network, there is no lookup during the Graphhopper import.
Indeed, it is actually quite easy to implement! Thanks @easbar. |
|
I'm not sure if we should mix the Again citing the OSM wiki:
If someone uses regular OSM pbfs with this workaround, i'd expect breakage. |
|
@otbutz, I understand that:
That is why the draft PR does not use the Then it is the choice of the user:
@otbutz, does it clarify? |
|
Let's move this discussion to #2373 |
The node tag "ele" is only meant to record above sea level elevation for special points like mountain peaks, but its not really meant to be used to provide elevation data for road networks:
From the osm wiki:
Handling of this tag was only used in tests so far, so I removed it here. Similar changes to the ones here were already done by @otbutz in #2193.