@@ -13,31 +13,32 @@ pip install closecity
1313pip install " closecity[tiger]" # to auto-download census-block boundaries
1414```
1515
16- This pulls in ` httpx ` and ` geopandas ` , so feature methods return GeoDataFrames out
17- of the box.
16+ This pulls in ` httpx ` , ` pandas ` , and ` geopandas ` , so results come back as data
17+ frames out of the box: a GeoDataFrame where geometry applies, a plain DataFrame
18+ otherwise.
1819
1920## A first call
2021
21- You make requests through a client. Feature results come back as GeoDataFrames, so
22- you can map them right away.
22+ You make requests through a client. Routes with geometry come back as
23+ GeoDataFrames, so you can map them right away.
2324
2425``` python
2526from closecity import Client
2627
27- # The key (ck_live_ or ck_test_ ) comes from https://account.close.city
28+ # The key (ck_live_) comes from https://account.close.city
2829close = Client(" ck_live_your_key" ) # use your own key here
2930
3031# Grocery stores within a 1.5 km walk of a point, as points:
3132groceries = close.pois_search(lat = 41.823 , lon = - 71.412 , radius_m = 1500 , type = 30 )
3233groceries.plot()
3334```
3435
35- Catalog and lookup routes are free and need no key:
36+ Catalog and lookup routes are free, need no key, and come back as data frames :
3637
3738``` python
3839close = Client()
39- close.modes().data[ " modes " ] # walk, bike, transit
40- close.places(" Providence" ).data[ " places " ][ 0 ] # a city name to its GEOID and centre
40+ close.modes() # walk, bike, transit
41+ close.places(" Providence" ) # a city name to its GEOID and centre
4142```
4243
4344## Words you will see
@@ -53,14 +54,20 @@ A few terms come up throughout the API:
5354 polygon.
5455- ** Catchment.** The reverse of an isochrone: every block that can reach a place.
5556
56- ## Spatial output, on or off
57+ ## Choosing an output
5758
58- Feature methods return GeoDataFrames by default. Block routes join census-block
59- boundaries for you, using ` pygris ` (the ` tiger ` extra) to download them once. To work
60- with the raw data instead, build the client with ` spatial=False ` :
59+ Set ` output ` on the client, or per call:
60+
61+ - ` output = "spatial" ` (the default) returns a GeoDataFrame where geometry applies
62+ and a DataFrame otherwise. Block routes join census-block boundaries with
63+ ` pygris ` (the ` tiger ` extra), downloaded once and cached.
64+ - ` output = "tabular" ` returns a plain DataFrame for every route and never
65+ downloads boundaries. Reach for it when you only want the numbers.
66+ - ` output = "raw" ` returns the underlying ` Reply ` / ` Paginator ` , with the parsed
67+ body on ` .data ` and the token counts alongside.
6168
6269``` python
63- close = Client(" ck_live_your_key" , spatial = False ) # use your own key here
70+ close = Client(" ck_live_your_key" , output = " raw " ) # use your own key here
6471for poi in close.pois_search(lat = 41.823 , lon = - 71.412 , radius_m = 1500 ):
6572 print (poi[" name" ])
6673```
0 commit comments