Installation

pip install closecity

This pulls in httpx and geopandas, so feature methods return GeoDataFrames out of the box.

Optional extras

In the default spatial output mode, block methods (blocks_query, place_blocks, poi_catchment) join census-block boundaries. To let them download the boundaries for you, add the tiger extra:

pip install "closecity[tiger]"

You do not need it for output="tabular", which returns the same rows without geometry.

Plotting a GeoDataFrame uses matplotlib:

pip install matplotlib

API keys

The catalog and lookup routes are free and need no key. Every data route needs a key (ck_live_), created at account.close.city.

from closecity import Client
close = Client("ck_live_your_key")   # use your own key here

Python 3.9 or newer is supported.