OSM2Attractiveness is a geodata processing workflow that converts OpenStreetMap (OSM) data into zone-level attractiveness indicators. It is originally developed by the Karlsruhe Institute of Technology (KIT), Institute for Transport Studies.
The pipeline is intended for transport and spatial analysis use cases where destinations (e.g., shopping, services, leisure, health) need to be represented as comparable attractiveness values per zone.
At a high level, the workflow contains three stages:
- Filter raw OSM data into category-specific OSM files.
- Convert those category files into standardized POI geodata.
- Aggregate POI information to zone-level attractiveness.
The repository currently includes an example configuration for German attractiveness factors and a German example area of interest (Rastatt town). It is easily configurable to be used for the specific factors of other areas of interest.
For methodological background see, e.g.:
- Klinkhardt, C.; Wörle, T.; Briem, L.; Heilig, M.; Kagerbauer, M.; Vortisch, P. (2021). Using OpenStreetMap as a Data Source for Attractiveness in Travel Demand Models. Transportation research record, 2675 (8), 294–303. doi:10.1177/0361198121997415
The framework was presented at State of the Map 2026, the presentation is available here.
This section explains how to run the project on a local machine.
Required software:
- Windows (current scripts are written and configured for Windows paths/commands)
- Python 3.10+ (recommended)
- R 4.2+ (for POI-to-attractiveness aggregation and evaluation scripts)
- Osmosis (required for OSM filtering)
- QGIS or other GIS software to repair buildings geometries
Python packages (see requirements.txt): geopandas, pandas, shapely, pyyaml.
R packages used by the make and evaluation scripts: this.path, yaml, data.table, sf, jsonlite, digest, ggplot2, mapgl
Data prerequisites:
- A raw OSM PBF file, available e.g. by Geofabrik
- attractiveness-factors
- A zones layer (GeoJSON or similar)
- Clone the repository.
git clone https://github.com/kit-ifv/osm2attractiveness.git
cd osm2attractivites- (Recommended) Create and activate a virtual environment.
python -m venv .venv
.venv\Scripts\activate- Install Python dependencies.
pip install -r requirements.txt- Install R dependencies.
install.packages(c("this.path", "yaml", "data.table", "sf", "jsonlite", "digest", "ggplot2", "mapgl"))- Adapt the config file in config or create your own by copying an example: config/config_rastatt_example.yaml
Run the workflow from repository root in the following order.
Creates category-specific .osm files in data/osm-filtered.
python src/make/FilterOSM.py config_rastatt_exampleNotes:
- The script first creates an area extract from the raw
.osm.pbfusing the configured bounding box. - If no config argument is passed, all scripts default to
config_rastatt_example. - Filters use the syntax described in Osmosis docs. Filters are logical
OR, i.e., only one conditions needs to be fulfilled. - Filter files support multi-step filters: each non-empty line in
filter_<Category>.txtorreject_<Category>.txtis applied as an additional--tag-filterstep. In this way, logicalANDconditions are can be achieved.
Example (filter_SportsHall.txt):
leisure=sports_centre
building=* building:part=yesCreates standardized points-of-interest files (GeoJSON) and a processed buildings file.
python src/make/OSM2POIs.py config_rastatt_exampleAggregates POIs to zone-level attractiveness numbers (CSV file). As an intermediate step, POIs with attractiveness values are created and exported as well (GPKG file).
Rscript src/make/POIs2attractiveness.r config_rastatt_exampleGenerate maps with attractiveness value per activity (zone- and grid-based)
Rscript src/eval/eval_maps.r config_rastatt_exampleArea-specific configuration files and filter definitions:
- Main run configs (bounding box, paths, CRS, exclusions)
- Locale/config support files (e.g., POI parameters, attractiveness factors)
- OSM filter rule files in config/filters
Input and output data folders:
osm-raw: raw OSM PBF sourcesosm-filtered: category-level OSM extractspois: generated POI filesattractiveness*: attractiveness calculation outputs
Core processing scripts:
FilterOSM.pyOSM2POIs.pyPOIs2attractiveness.r
Evaluation and QA scripts for generated POIs/attractiveness. They are in draft status.
Project documentation and supporting notes. To be extended.
- Only dummy attractiveness factors are included. Replace them with validated attractiveness factors. For Germany, we recommend Ver_Bau as a suitable reference: https://bbwsoftware.de/
- Buildings input often requires cleaning (repairing geometries) in a GIS before use (open the
multipolygonslayer in QGIS and run the toolfixgeometrieswith the following parameters:INPUT='Region_Buildings.osm|layername=multipolygons' METHOD=1 OUTPUT='Region_Buildings_repaired.gpkg'). - Some filter categories exist that are currently not used in the attractiveness value generation (e.g., parking, hotels, tourism, EV charging, mailbox). They may be useful for other analyses.
- Workplaces are currently not generated by this workflow and should be integrated from other data/methods.
- Output should always be validated for local plausibility because OSM tagging quality and semantics vary by region.
- Generally, the attractiveness values are based on the average of similar places. Places that - for any reason - are in some way "special" may have attractiveness values that are orders of magnitude larger. Especially, care needs to be taken with respect to how tourist sites should be considered (depends on the aim of the travel demand model).
The following are possible improvements for this workflow. We welcome contributions.
- Extend support to additional countries with reusable locale/config packages.
- Improve automatic detection/handling of unusually large specific-purpose areas (outliers in OSM tagging).
- Improve floor-area estimation logic, especially for multi-level buildings and partial-building occupancy.
- Improve building-height and vertical-structure assumptions.
- Add more transparent intermediate components/summands for easier plausibility checks.
- Create validated open-source data for attractiveness factors.
- Simplify code.
- Use config in evaluation scripts.
- Add automated tests.
- Improve multi-OS support (current implementation is Windows-focused concerning Osmosis run commands).
- Evaluate migration from Osmosis (legacy) to Osmium or other maintained OSM-tooling.
Contributions are welcome. Please open an issue for bugs, data-quality edge cases, or methodological suggestions before major changes.
When contributing code, include:
- A short rationale for the change
- Any config/data assumptions
- Validation notes (what was tested and on which area)
- Python-only adaption: https://github.com/m-schi/OSM2AttractivenessPy
This project is licensed as described in LICENSE.md.
Thanks to the OpenStreetMap community for providing the data.