Hello, i would like to know how to simplify the geometries more than the simplify settings, i tried with python the problem is it’s very long, it’s working but take so many hours and ram to custom the planet pbf. Thank you for your help
Can you describe in more detail what you are trying to achieve and what your problem really is, such as which graphhopper version you are using, which area of osm input data you need, the specs of your machine in terms of RAM, …
It looks to me as if you are trying to do something with the whole planet and some process (graph creation?) is taking more time then you expect.
Hello, I achieved what I wanted by simplifying the geometry and improving the precision of elevation data, while reducing the number of nodes by half. A large portion of the nodes, such as those around roundabouts, were unnecessary. By removing them, the server now requires roughly half the RAM and can process routes much faster. This also reduces the hardware requirements for importing data without issues. Thank you for your time!
Feel free to share the configuration or what you did to achieve it ![]()
I use a Python script to filter the PBF file before importing it, combining distance and heading to preserve all instruction points and strategic locations. For the planet-wide data, the script takes around 4 hours to run, which is fine since I import new data every week — it works great. I actually save a lot of time during the GraphHopper import process, so there’s no real loss overall.
Did you try GraphHoppers internal simplification? It should have no overhead.
You should get less points in the geometry if you increase this from 0.5 meters “deviation”:
routing.way_point_max_distance: 0.5
And there are a couple of more options regarding elevation if you enable graph.elevation.edge_smoothing.
Yes, I’ve tried, but it’s really not useful. My algorithm is exactly what I needed, and as I said, the time I lose running it, I make up for during the graph build — so it’s perfect for me ![]()
but it’s really not useful.
Why? If you want to simplify geometry it should do exactly what you want.
And what exactly does your algorithm do?
I filter based on heading and distance, applying different heading thresholds depending on the distance, and then run a second pass with Douglas–Peucker. If there’s a way to do this directly in GraphHopper, I’m all ears, because the settings you mentioned aren’t really useful — or maybe I’m not using them correctly? The documentation is very poor
What does this mean? Why isn’t running douglas peucker once sufficient?
or maybe I’m not using them correctly? The documentation is very poor
Did you try to increase the parameter I mentioned in the config?
Yes, I’ve tried, but it’s not what I need. The data aren’t very accurate, and the built-in filtering is quite poor. My algorithm removes about half of the points in the graph, keeping only the necessary ones, whereas the parameters barely remove any points and end up ruining the accuracy.
If the data is not accurate - you can’t improve it via removing points and/or I do not fully understand what you mean.
the built-in filtering is quite poor
These are harsh words from someone who does not expose what he is doing. Do you plan to open source your python script?
Also the built-in filtering is just douglas peucker. No magic. But it can also reduce the number of points - IF you accept a decrease in geometry quality.
whereas the parameters barely remove any points and end up ruining the accuracy.
What do you mean with “accuracy”?
Yes but mine do douglass peucker perpendicular, that’s the difference and the first filter is distance and heading, only douglass peucker perpendicular don’t do what i am doing with the combinaison of both.
I will finish it i just have a little adjustment to do and i will publish yes
i think it will be useful for a lot of person
I’m still unsure what you mean with “douglass peucker perpendicular” and “first filter is distance and heading” and what it does as a result, but open sourcing the script might help.
Could you show me an example where normal douglas peucker produces a suboptimal result compared to your algorithm?
Also if we think it will be useful for others, we could go one step further and do it directly in Java.