feat(osm): 🎉 extract and visualize OSM data. #93
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A new tool allows to extract, clip, project and plot OSM data and is used for railway networks (strictly it is not limited to it).
For extraction the user specifies a bounding box or a polygon. In its interior the specified OSM data is extracted. The Overpass API is used with a recursive query to follow e.g. railroad tracks starting in the interior, but ending outside the extraction area. Also this will take intermediate data nodes into account. Therefore, data might extend beyond the specified extraction area.
Clipping functionality is provided to reduce the the amount of data extending from the extraction aread. It is tested which nodes and edges lie in the extraction area. If an edge starts in the interior, travels outside and ends in the interior again it will be kept. Also if the edge starts in the interior and ends in the exterior it is still kept.
When trying to visualize the data it might be disorted due to the missing projection. It is possible to apply elliptic Mercator projection to the data which will add X and Y coordinates to the data.
For visualization a plotting capability based on MatplotLib is introduced. Currently it assumes that it is used for visualization of railway data. Switches and buffer stop are separately marked by a symbol.
Control of the functionality is done using a CLI. Further information is available in the provided README.md
Unit tests and integration tests are provided leading to an overall coverage roughly greater than 80%.
The existing project configuration (pyproject.toml) is extended to treat the OSM extractor as a separate package with a cli. During the test with PyLint it complied about the identation even ruff had formatted the files. Therefore, configuration was adopted to work consistently to ruff.