Python script for QGIS to generate street parking data from OpenStreetMap (OSM) data
- Run Overpass-Query for road network and street parking data
- Export result as GeoJSON to 'data/input.geojson'
- Run this python script in QGIS
- "Plugins" => "Python Console"
- (If internal Python Editor Panel is hidden: Right click in Console => "Show Editor")
- Open File in QGIS Python Editor
- Run from there (Note: Do not use the "Browser" => File => "Run Script")
Check the resulting street parking data for accuracy and bugs, depending on how precise you need them. Street side and kerb parking as well as street segments with diagonal or perpendicular parking have the highest potential for accuracy failures, depending on how accurately the OSM data is mapped.
With very precisely mapped street parking information, this script can provide very accurate data - but this requires intensive micromapping. An example of the use of the data is the Neukölln Parking Map (for this rendering, the resulting parking data were aligned to the kerbs and manually post-processed and styled).
The script generates georeferenced line features representing street parking lanes. The lines are rendered in QGIS with a basic styling and can afterwards be further edited or spatially analysed as required. To understand, how the results are interpolated, some "cutting" areas and features are also rendered.
The attributes include key parking information such as the capacity of a parking lane (number of parked vehicles), orientation and position (e.g. parallel or diagonal, on the carriageway, on the pavement, in a parking bay etc.), parking restrictions (free, paid, residents, time limited, disabled, temporary no parking, vehicle restrictions etc.) as well as other information (e.g. surface, parking zone, markings...) if this information is mapped in OSM.
- Calculation of parking lanes according to the OSM Street parking scheme
- Interpolation of intersection areas and inclusion of driveways, traffic lights, crossings, bus stops and some other spatial features that influence parking
- Including separately mapped street parking areas (e.g. street-side parking bays)
- Basic interpretation of parking restrictions
- Street parking data can optionally also be output as point chains, where each point represents a single parking space
-
Directory: Make sure that there is no folder containing the string "street_parking.py" in the directory path (but the script itself is called exactly that) and that the following directory structure exists:
└ your-directory ├ data/ ┊ └ input.geojson ├ styles/ ┊ └ [various style files for basic rendering].qml └ street_parking.py
-
Coordinate Reference System: Results are saved in EPSG:25833 (ETRS89 / UTM zone 33N). A different CRS may be necessary at other locations and can be set at the top of the script.
-
Highway Line Representation: There is no consensus yet on which line the highway objekt in OSM represents exactly: The centerline of the carriageway or the driving line. So far, this script calculates the location of parking lanes according to variant B in this figure (driving line).
-
This script is intended for the calculation of parking spaces on (or next to) the street. Depending on your needs, it may be useful to include parking spaces in car parks, multi-storey car parks, underground garages, etc.
-
This script is working for countries with right hand traffic. In countries with left hand traffic, some adjustments might be necessary (not tested/supported yet)
-
Background: This script was originally based on very basic programming and QGIS knowledge. Many steps have been solved more effectively in the meantime, but there are more that can certainly be solved much more elegantly. Plus there are still some (marked) TODO's that would make it even better. I am happy about improvements and extensions!
There is a detailed report about the methodology of OSM street parking analysis in German language as well as a shorter english blog post. This is also the base of the OSM Street Parking Project, which has further automated this methodology and made the interpolation of OSM street parking data more scalable.