-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ogr2osm ignores elevation data of GeoJSON files #36
Comments
I don't think this is something to be fixed in ogr2osm since the OSM format does not support elevation data. Currently ogr2osm processes the 2.5D features but only takes longitude and latitude in account (or X and Y as they are called in ogr). That doesn't mean you can't do something creative with the third dimension 🙂 It involves writing some logic in a translation file but I don't think it is really straightforward here. I'll probably have more time in a couple of weeks, if you want to investigate yourself in the meanwhile then the following information might be of interest to you:
|
Thanks for the info! I will just read over the texts in the coming days. |
Hmm, it seems we will need to implement this logic. I reviewed my source GeoJSON file, and it only contains For my specific case, perhaps I can modify the GeoJSON file to also contain However, I am thinking your method still does not work in general. No matter what information I store as tags inside the Lines 186 to 187 in f7d2f33
and also Lines 91 to 95 in f7d2f33
Lines 100 to 111 in f7d2f33
which results in the following:
However, if the existing code is already mentioning
then perhaps we are very close to implementing the relevant logic. |
I see, your observations are correct. It is pointless to add the linestring tags to every single node in the resulting osm file, but then only the coordinates can be used to decide if merging is necessary or not. In order to do something creative with the z-value it should be available, but I would not limit the use to merging or not as you did in your pull request. The logic you want can be implemented by adding the z-value as a tag, ogr2osm will automatically consider two nodes with different tags as 2 separate nodes (which can still be overridden using a translation file if required). Looking at the pull request you created you already found where to add the logic but the implementation is a bit different.
and in
No need to modify anything in Of course this was a quick test, I do not have time at the moment for the full implementation. We need the following:
Also, while I was thinking about this issue a question came up. How can two nodes with the same coordinates have two different z-values? It implies the z-value is used for something else than the elevation, which is fine for me but it shows the need to think about a general solution where the z-value is available somehow in the translation file. |
Indeed, my PR is a naive implementation that makes things work when trying to split nodes of different Z elevations. Perhaps a full implementation would require us to handle user-supplied "get elevation of node" function (and also store the elevation elsewhere in the code) so that we can at least inject the node elevation back to the translation file when e.g. merging nodes, instead of just giving a Also, something like |
It is implemented as follows:
I will give it a few days before merging into the main branch, I usually find another bug when I look at it with fresh eyes. Don't hesitate to test branch |
Merged into main, release follows later this week. |
While converting a GeoJSON file to a OSM file using ogr2osm, I noticed that ogr2osm will ignore the elevation data when assigning temporary OSM nodes to the GeoJSON LineStrings. This has created non-existent ways between supposedly-separate nodes.
Example:
This GitHub document also confirms the same thing:
https://github.com/osmandapp/OsmAnd-tools/blob/master/obf-generation/basemap/ogr2osm/ogr2osm.py
Is this a problem of ogr2osm that should be fixed? Or, is there some other ways for me to mitigate this (eg change the CRS inside the GeoJSON file so that ogr2osm can read the elevation data)?
Thanks in advance!
The text was updated successfully, but these errors were encountered: