nsNicola Simboli
All projects Python · GeoJSON / Beta

geoClassy

A Python package for classifying geographic points against GeoJSON boundaries. Connect locations to the regions, municipalities or territories that matter to your analysis.

The problem

A coordinate becomes useful for business analysis when you know its sales territory, municipality or district. geoClassy assigns points to polygons from a GeoJSON file you provide.

The idea started with OpenStreetMap boundaries, but any GeoJSON source works: find the neighbourhood with the most holiday-rental beds, assign customers to key-account areas, or filter road accidents by province.

A focused Python interface

import geoClassy

areas = geoClassy.load("territories.geojson")
df["territory"] = areas.locate_many(df.latitude, df.longitude)

Use your own boundary file and dataframe. The API takes latitude, then longitude; GeoJSON coordinate arrays use the reverse order.

Design decisions

  • Local boundary files: no lookup API or network request during classification.
  • Batch classification through locate_many.
  • An explicit overlap policy when a point matches more than one area.

This is point-in-polygon classification, not address geocoding. Boundary quality and the chosen overlap policy still determine whether the result fits your analysis.

Example and release

The repository includes an executable getting-started notebook, and a few ready-made boundary files are available on the resources page.

Something to improve?

Issues & feedback