InfraScan is a Python-based tool that fetches critical infrastructure data (power lines, hospitals, mines, government buildings, etc.) from OpenStreetMap using the Overpass API and generates KML files for easy visualization in GIS tools like Google Earth.
π GitHub Repository: aligundogar/InfraScan
-
Extract infrastructure data with Overpass API
-
Converts OSM JSON data into
.kmlfiles with coordinates and metadata -
Template-driven architecture: easily add new data types
-
Supports any country via ISO 3166-1 code (e.g.,
TR,DE,FR) -
Organized KML outputs ready for mapping and analysis
Install the dependencies with:
pip install requests simplekml
-
Clone the repository
git clone https://github.com/aligundogar/InfraScan.git cd InfraScan -
Prepare templates
Add Overpass QL
.tplfiles inside thetemplates/directory.
Each template must include{country}as a placeholder for ISO country codes. -
Run the tool
python main.py
-
Enter the country code Β Β Example:
TRfor Turkey,USfor United States. -
Find KML outputs Β Β All generated
.kmlfiles will be saved under thekml_outputs/folder.
InfraScan/
βββ templates/ Β Β Β Β # Overpass QL template files (*.tpl)
β Β βββ power.tpl
β Β βββ telecom.tpl
β Β βββ ...
βββ kml_outputs/ Β Β Β # Generated KML files (*.kml)
βββ main.py Β Β Β Β Β # Main script
βββ README.md Β Β Β Β # This document
Example (templates/water.tpl):
[out:json][timeout:60];
area["ISO3166-1"="{country}"]["boundary"="administrative"]["admin_level"="2"]->.searchArea;
(
node["man_made"="water_works"](area.searchArea);
node["man_made"="water_tower"](area.searchArea);
node["man_made"="reservoir_covered"](area.searchArea);
);
out body geom;
>;
out skel qt;
β
{country} is automatically replaced at runtime. Β
- Overpass API may throttle large queries. Increase
[timeout:60]if necessary. - Templates must correctly define the search area using
{country}to work. - Both
node,way, andrelationobjects are supported depending on infrastructure type.
This project is licensed under the MIT License.
Developed by Salva (Ali GΓΌndoΔar) πΉπ·