So one thing I have to do frequently at work, is responding to diverse audience about overlapping geometries: points, areas. Usually, checking if a coordinate or a shapefile intersects a reference area involves opening heavy software, importing layers, and running tools manually for every single case.

I’ve been using QGIS everytime to do this simple check. While it´s not a time-consuming task, it can add up. Also, not everyone knows how to use QGIS or other softwares.

So I built a simple Python script to solve that in a quick manner, using GeoPandas and Shapely.

It can be run as a python script:

 

check_geom

 

or just double-clicking, as a .bat file, since I created it in Windows os.

 

check_geom

 

Results indicate if there is overlapping, and if there is, how much (in hectares).

 

check_geom

Although incredibly simple, it saves time, and colleagues who dont use QGIS or similar can actually answer these simple geometries closeness and overlapping themselves, also in a very simple manner.

 

Why is this important at my work

A common example would be a person or even a public institution questioning whether their property is nearby or overlaps with government areas of interest (the ones we are working on).

So, in this logic there are the government areas of interest in process (called “BASE”) but treated as the first input, and the other input, the geometry of the third party.

 

General view

 

├── .venv/

├──main.py

├──initiate_analysis.bat

├──history.csv (this is a logging file, keeping record of the consults)

├──README.md

 

Some relevant aspects

  • Maintains State: It loads the base geometry once and keeps it in memory, meaning you can perform several consultations based on that base file, until you inform that you want to use another one.

  • Standardizes Input: It automatically converts different CRS (Coordinate Reference Systems) to a single target EPSG, so Lat/Long points and SHP files talk the same language. Assuming both are close enough (since it raised the question) that they’re in the same epsg.

  • Loops the Logic: After each analysis, it stays open. You can just feed it the next input immediately without restarting the environment.