Skip to content

InfraScan is a simple Python tool that uses the Overpass API to pull critical infrastructure data (energy lines, hospitals, mines, etc.) for any country and converts it into KML files. You can then open the generated KMLs in Google Earth or any other GIS software to visualize and analyze.

Notifications You must be signed in to change notification settings

aligundogar/InfraScan

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌐 InfraScan

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


πŸš€ Features

  • Extract infrastructure data with Overpass API

  • Converts OSM JSON data into .kml files 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


πŸ› οΈ Requirements

Install the dependencies with:

pip install requests simplekml

βš™οΈ Usage

  1. Clone the repository

    git clone https://github.com/aligundogar/InfraScan.git
    cd InfraScan
  2. Prepare templates

    Add Overpass QL .tpl files inside the templates/ directory.
    Each template must include {country} as a placeholder for ISO country codes.

  3. Run the tool

    python main.py
  4. Enter the country code Β  Β Example: TR for Turkey, US for United States.

  5. Find KML outputs Β  Β All generated .kml files will be saved under the kml_outputs/ folder.


πŸ“‚ Project Structure


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 Template

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. Β 


⚑ Notes

  • 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, and relation objects are supported depending on infrastructure type.

πŸ“„ License

This project is licensed under the MIT License.


πŸ‘¨β€πŸ’» Author

Developed by Salva (Ali GΓΌndoğar) πŸ‡ΉπŸ‡·

About

InfraScan is a simple Python tool that uses the Overpass API to pull critical infrastructure data (energy lines, hospitals, mines, etc.) for any country and converts it into KML files. You can then open the generated KMLs in Google Earth or any other GIS software to visualize and analyze.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published