Package: openspoor
OpenspoorThe openspoor package is intended to allow easy transformation between different geographical and topological systems
commonly used in Dutch Railway and prepare this data for analysis and visualisations. Its goal is to be publicly available and function as an open source package.Currently the openspoor package allows the following transformations:Type of input:Point dataThese transformations can be performed between the following systems:Geographical systems:WGS84 coordinate system (commonly known as GPS coordinates)EPSG:28992 coordinate system (commonly known in the Netherlands as Rijksdriehoek)Topological systems:Geocode and geocode kilometreringSpoortak and spoortak kilometrering (unavailable on switches)Spoortakken of different historical versionsGetting StartedInstallation - usageWindowsOpenspoor is dependent on Fiona and GDAL, which are missing Windows dependencies on PyPi.Use conda to install Fiona and GDAL:conda install -c conda-forge Fiona GDALpip install openspoorLinuxpip install openspoorMacconda create -n [env_name] python=3.11conda install -c conda-forge proj=7.0.0conda install -c conda-forge pyproj=2.6.0pip install openspoorThe steps above involving conda(-forge) are necessary for Mac M1 chips (used since Nov 2020). In case your Mac does not
have a M1 chip, thenpip install openspoorshould suffice.Installation - developmentWindowsInstallation using anacondaClone the "openspoor" repositorygit clone https://github.com/ProRail-DataLab/openspoor.gitcreate an environment:conda create -n openspoorenv python==3.11activate the environment:conda activate openspoorenvinstall dependencies:pip install -r requirements.txtIn the root directory of the repository, execute the command:pip install -e .[dev]In the root directory of the repository, execute the command:pytest --nbmake --nbmake-kernel=python3If all the test succeed, the openspoor package is ready to use and you are on the right "track"!LinuxInstallation using anacondaClone the "openspoor" repositorygit clone https://github.com/ProRail-DataLab/openspoor.gitcreate an environment in your preferred way in Python 3.8 and activate. For example:python3 -m venv venvsource ./venv/bin/activateactivate the environment:conda activate openspoorenvupdate pip:pip install --upgrade pipinstall dependencies:pip install -r requirements.txtIn the root directory of the repository, execute the command:pip install -e .[dev]In the root directory of the repository, execute the command:pytest --nbmake --nbmake-kernel=python3If all the test succeed, the openspoor package is ready to use and you are on the right "track"!Demonstration notebookIn the demo_notebook folder a notebook can be found that demonstrates the example usage of the openspoor package.DependenciesThe transformations available in the openspoor package rely completely on data and API's made available athttps://mapservices.prorail.nl/. Be aware of this dependency and specifically of the following possible issues:The use of API's on mapservices.prorail.nl is changedThe output data of the mapservices API's is changed (with added, removed or missing columns for instance)StructureThe openspoor package is split into 4 categories.MapservicesThe MapservicesData classes use mapservices.prorail.nl API's to retrieve the necessary data to perform transformations.
The essentially function as an interface with the topological systems used by ProRail.PUICMapservices provides general data about railway tracks (spoor) and switches (wissel and kruisingbenen). This
contains information regarding Geocode, geocodekilometrering, but also Spoortak identificatie.SpoortakMapservices provides information about railway tracks concerning Spoortak identificatie and lokale
kilometrering.TransformersThe various transformers use the geopandas dataframes obtained by MapservicesData objects to add additional geographical
or topological systems to a given geopandas input dataframe. The current transformers only function for geopandas
dataframes containing Point data. The available transformers are:TransformerCoordinatesToSpoor: transforms WGS84 or EPSG:28992 coordinates to spoortak and lokale kilomtrering as well
as geocode and geocode kilometrering.TransformerGeocodeToCoordinates: transforms geocode and geocode kilometrering to WGS84 or EPSG:28992 coordinates.TransformerSpoorToCoordinates: transforms spoortak and lokale kilometrering to WGS84 or EPSG:28992 coordinates.Spoortakmodelmapservices.prorail.nl only provides current information about the topological systems used in Dutch
Railways. As the topological systems tend to change with time, due to changing infrastructure and naming conventions,
the current topological system is not necessarily sufficient to provide transformations on historical data. We added
historical topological systems as part of the functionality of this package in such a way that it
is available publicly. This enables users to also knwow where assets where in previous versions of the
track topology.VisualisationsThis part contains functionalities to plot locations on a map of the Netherlands.This currently supports pandas or geopandas dataframes with locations of either points or linestrings.Release History0.1.9Added spoortakmodel and visualisationsUpdated readme0.1The first proper releaseADD: transform point data between geographical systems.0.0.1Work in progressContributingThe openspoor package stimulates every other person the contribute to the package. To do so:Fork itCreate your feature branch (git checkout -b feature/fooBar)Commit your changes (git commit -am 'Add some fooBar')Push to the branch (git push origin feature/fooBar)Create a new Pull Request with 3 obligated reviewers from the developement team.You could also contribute by working on one of the open Issues as noted on the GitHub page.