Repository navigation
Conversation
added classes for encoders to access geometry added sample Bike Encoder that routes in 3D by modifying speed
cloned long long version of BTree elevations available in whole reader up to distance calculation
|
Thanks! How can I try this and download a simple DEM file for my location? Will also pure srtm files work? Or only cgiar? |
|
The required DEM files are downloaded automatically for the bounds of the OSM file. CGIAR only. |
|
Ok, I just needed to specify the location for the DEM files - nice! And really nice work! When downloading several problems could happen (network problems, out of memory errors, ...) so that the import process has to be run again and again. I would like to separate download from import somehow. So instead of putting DEM handling inside the OSMReader (which makes things there even more complicated) we have to put it into a post processing step, which would also reduce the maximum necessary RAM as no import data structures has to be hold in memory at the same time. Or why did you need it there? Additionally we then could process the graph tile by tile which would make the DEM import more scalable. Some more todos for us:
|
Postprocessing does not work. The required order is:
The only way to seperate this would be to build a DEM download module that runs before the OSMReader to make sure all DEM data is already there. Disadvantages
Adding an optional DEM prefetch sounds ok, but downloading on demand ist the easiest way if it works. |
Yes. true. But can we somehow making it possible? I'm thinking more about this: calculating 'important' flags on the osm import. Then for the post processing: enhance or set the final flags. I've have to think about the separation (very hard!) but we should really separate this! Also for the future it is very important that we don't increase the complexity and memory usage of the import process. |
|
I disagree.
In my opinion we should rather use efficient file-backed data structures so the import will run with about any amount of memory and can be supported by using an SSD for the files. |
we just need to create some (additional) post processing of the graph. not of the OSM file. see below.
We don't need the big longlongmap when OSM import is finished. so this would save us lots of GB memory for the full planet scenario.
There is no third pass of OSM file. it is just as we do with subnetwork removal: we use the data already present in the graph and traverse the graph + improving/setting speed values from elevation data. What other data do we need besides the GPS coordinate?
My fear is just that with every feature request we increase the number of necessary parameters in methods like handleWayTags, addOSMWay, ... so instead I would rather introduce some sort of separation - be it a for-loop in the OSM import or a post-processing chain
This will be an additional task, yes. but as this DEM import is possible IMO without a higher memory usage we should concentrate on this as using file-backed data structure will decrease the import speed a lot. |
The OSM tags. :-) What I am planning needs a combination of several OSM tags (highway, tracktype, surface, sac_scale) and the incline of the way to decided on the flags. Upward has a much higher speed than downwards, and the continuity of the incline can modify this too. You can't do this with the graph only. You would have to make throwaway flags to encode way type information you never need for routing, just to use it as input in the elevation calculations. I don't want the reader needlessly complex either. Thats the reason why I built GeometryAccess so you don't have to know how the reader and graph store their data to write an encoder. But separating things that belong together is not helpful. To write really intelligent Encoders you need all tags, relations and elevation at the same time. |
ah, ok. Of course then this isn't (easily) possible with a post processing step!
Hmmh, the only thing I don't like is the very suboptimal access of elevation data. If we could somehow traverse the graph more like it is structured then a file based approach to access this elevation data wouldn't be that slow I guess ... |
|
Ok, going on here since some time ... I found a replacement called Apache xmlgraphics for JAI which has a better license and offers exactly the same classes as JAI (SeekableStream, TIFFDecodeParam, TIFFImageDecoder). I have the following plan to integrate this pull request:
** As a side note: it is not necessary to extend LongLongMap (OsmNodeTranslation) because instead of storing the elevation data in the map it it a lot easier to reserve additionally two bytes in the DataAccess object In order to make it working I would really appreciate your help (e.g. see below) as I cannot just merge this code. For that I'll create a new dem_data branch with as many possible code as possible, of course. I need to understand some more parts:
|
Cool, then it should be directly exchangable.
Again: You do not need a licence. It is ok for everybody to use the CGIAR data for their own purposes. It is probably ok to evaluate the data. It is ok to redistribute the dataset for free. It is just not ok to redistribute the original dataset commercially. If you want to use SRTM data please keep in mind:
If we have different datasets we need a configuration for the type of datasource and a factory pattern to instantiate the right tile class.
What do you mean? The CGIAR classes are already implemented in the pull request. Do you want to merge them on a different branch? |
The data from the ele tags is worthless and should not be used
|
Took me a while - I have written that code 7 months ago and never had to look at it again. :-) After you split a node into two to introduce a barrier edge it is necessary to also copy the elevation stored with the original node into the new node. That is what this line does after creating the node. If you change the location of the elevations to a dataAccess you will have to do something similar in that structure. I did it this way to avoid adding an elevation parameter to all node creation and node handling functions which would make them more complex even if you are not using elevations at all.
GeometryAccess encapsulates the actual storage locations of nodes and elevations and hides them from the Encoders. This way the Encoders do not need to know where and how the geometry is stored, they just request nodes and elevations and analyze them. I found the access to geometry pretty cumbersome with the distinction of tower and pillar nodes, the index calculations and elevations from yet another location. Without GeometryAccess, you would have to duplicate all that code in every Encoder that needs to anlayze elevations or geometry e.g. to determine whether a road is straigt or has narrow bends. |
The elevations are required for ALL nodes, not just for tower nodes. But if you find a better way to store them temporarily that's great. Do you plan to integrate the actual use of DEM data too or should that be a different step? There is an important change in the encoders. I introduced a second phase to the encoding. The first phase evaluates the OSM tags for the OSM way as usual. The second phase evaluates the elevations/geometry for each edge and completes the flags. This is important, evaluating elevations for the whole OSM way does not work, the evaluation is different for each edge. I go even further and subdivide every edge longer than 100 meters for the analysis. Experiments showed that there are quite a number of long roads or tracks that run over a hill or through a valley with no intersections. If you just look at the elevations of start or end you would miss the hill/valley completely. I have designed it to be optional, controlled by the queryNeeds() function as it requires the DEM model to be present for the whole import. |
I'm not a lawyer but they (and you) say not for commercial purposes - how to define this? I think this is a gray area and I don't want to invest time there. But as you have it already implemented. Nothing is wrong with integrating it as one implementation.
ok
Indeed it is cumbersome and ugly. I'll have to think about if we can somehow avoid this in the encoders and e.g. 'enhance' the OSMWay or OSMNode object to provide this information in an easier 'fashion'.
ah, ok. Yes, you told me already but I thought it was only because the data is only punctual available. Now with the gaussian method this was interesting again for me. But the inconsistency is a bad thing.
ok, thanks. I'll investigate.
No, in the same branch. But it should be done from you :) (?)
I think, yes for the branch but not at the beginning probably.
Thanks! I'll also have a look into it! |
Well, I think GeometryAccess is already pretty simple. Adding it to the OSM stuff ist not really logical as the elevations are not related to the OSMNodes and you can have interpolated or derived Geometry that does not correspond to an OSMNode at all, but you still might need to get an Elevation value for it. |
No problem. But then we should discuss the common wrapper and DEMTile factory before. |
You do not need to. The key word is "original dataset". If you just use the data for calculations or extract a few locations, you are not redistributing the original dataset and it cannot be reconstructed from the excerpts. The licence is not aggressive or virulent like many others. |
|
Ah, no. Looks like it is also not the best in terms of licensing http://igorbrejc.net/openstreetmap/viewfinders-dem-data-comparison-with-srtm |
Yes. Never used it due to licencing terms and heterogenous data (better in some areas, unavailable in others). |
|
I'm doing development in the branch dim3, there is still a bug. But it already works. Current status:
This is now implemented although we should provide an option if the elevation data should only influence speed and distances or if it should be available on response as well (which means it is necessary to store the elevation info per node)
This can be used now, but not implemented.
This should work now
Yeah, that is really ugly and occurs relative often. But a floodfilling algorithm should not be that hard though. @NopMap Or maybe you can adapt your existing CGIAR import? The good news is that those guys have now allowed usage of their data for GraphHopper! http://graphhopper.com/public/license/CGIAR.txt Please give me feedback and ask me if you have questions! |
|
Hi Peter, They also have a plotting tool can be used to create a height map for a Best regards, Raphael PS: Will try out that branch on the weekend On Wed, Feb 19, 2014 at 12:34 PM, Peter [email protected] wrote:
|
As discussed earlier. We won't use this due to the unclear license. Of course, you could go and implement a new ElevationProvider ...
What do you mean with this? We don't plot maps or overlays with GraphHopper or what use case did you have in mind? Or do you mean to use it as it fills the voids?
This can be easily implemented now. After fixing some bugs I'll indeed use the BikeWeighting (provided by @NopMap) to achieve exactly this. |
|
Hi Peter answers inline below On Wednesday, February 19, 2014, Peter [email protected] wrote:
Just write to Jonathan de Ferranti, it's handauthored and he was fine with
This was intended for incorporation in the WAR code, you could. Plot the
Related to this please consider my prior note on preprocessing relations
Prof. Dr. Raphael Volz Volz Innovation GmbH Web: www.volzinnovation.com Company Seat / Sitz der Gesellschaft: Loffenau |
We can already do this in dim3. See my screenshot above where the elevation data is plotted everytime a new route is calculated.
We already consider bike routes and prefer them via giving them higher speed (ugly workaround). In a later version a better solution can be implemented though. |
Penalize inner-link U-turns (builds on #83)

3D mode is activated by setting a path to/for the DEM data with OSMReader.setDemLocation()
The required DEM files are downloaded automatically for the bounds of the OSM file.
In 3D mode each node is assigned its elevation value before the ways are processed.
With normal encoders, the elevation difference is included in the edge distance calculation.
Elevation sensitive encoders can use the ElevationAnalyzer class to set parameters according to elevation difference or incline.
The class BikeTwoSpeedFlagEncoder is a bike encoder with two speeds for forward/backward which are modified depending on incline/decline. It can be activated in the configuration file like this
osmreader.acceptWay=BIKE,BIKE3D:com.graphhopper.routing.util.BikeTwoSpeedFlagEncoder
DEM handling needs a lot of memory (72MB for each 5°x5° area tile). It's prepared to scale to larger areas but that's not implemented yet.
If 3D mode is not activated, no additional memory is used.
Enables GH for #43