Your first walkability map

The quickest way to feel what Close gives you: read the walk times from a starting point, map the supermarkets you can reach on foot, then draw how far a 30-minute walk takes you. The example city is Providence, Rhode Island.

Running this tutorial uses about 90 tokens.

Set up

Build a client, then read what you need from the free catalog.

from closecity import Client, close_map

close = Client("ck_live_your_key")   # use your own key here
amenity_types = close.destination_types()
supermarket_type = amenity_types.loc[amenity_types["label"] == "grocery_stores",
                                     "dest_type_id"].iloc[0]

providence_ri = close.places(q = "Providence").iloc[0]
start_lon = providence_ri["lon"]
start_lat = providence_ri["lat"]

Read travel times from a starting point

Pick a starting point, here the centre of Providence, and ask how long it takes to walk to each kind of amenity. point_summary() takes a lat/lon instead of a block GEOID. Join the catalog’s readable name and sort by time, so the nearest things are on top.

walk_times = close.point_summary(lat = start_lat, lon = start_lon, mode = "walk")
walk_times = walk_times.merge(
    amenity_types[["dest_type_id", "name"]],
    on = "dest_type_id"
)
walk_times.sort_values("travel_time")[["name", "travel_time"]]
name travel_time
27 Non-frequent other transit stops 0.0
26 Non-frequent transit stops 0.0
28 Other transit stops 0.0
17 All transit stops 0.0
4 Restaurants 1.0
8 Cafes and coffee shops 1.0
18 Parks 2.0
22 Parks (<0.5 acres) 2.0
16 Libraries 3.0
31 Public libraries 3.0
5 Bars 3.0
7 Grocery stores 6.0
19 Parks (0.5–1 acres) 6.0
20 Parks (1–10 acres) 6.0
30 Parks (>1 acre) 6.0
29 Parks (>0.5 acres) 6.0
11 Pharmacies 7.0
14 Bookstores 8.0
15 Bike shops 8.0
6 Convenience stores 9.0
23 Playgrounds 9.0
32 University/private libraries 9.0
3 High schools 11.0
0 Public schools 11.0
21 Parks (>10 acres) 12.0
24 Bakeries 13.0
12 Preschools 13.0
13 Community centers 14.0
9 Dentists 15.0
10 Gyms and exercise studios 18.0
2 Middle schools 21.0
1 Elementary schools 25.0
25 Hardware stores 25.0

Map the supermarkets within a 30-minute walk

A 30-minute walk is a travel-time question, not a distance one, so let the routing answer it directly: point_pois returns every POI reachable from the starting point within max_minutes, each carrying its walk time, with no isochrone to overlay. close_map() draws them in one line, shaded by that walk time (blue = closest), with the starting point marked by an X and the city boundary behind for context.

nearby_supermarkets = close.point_pois(
    lat = start_lat,
    lon = start_lon,
    mode = "walk",
    type = supermarket_type,
    max_minutes = 30
)

city_boundary = close.place_boundary(geoid = providence_ri["geoid"])
close_map(
    nearby_supermarkets,
    fill = "travel_time",
    boundary = city_boundary,
    label = "name",
    mark = (start_lon, start_lat)
)

Draw how far you can walk

An isochrone is the headline map: the area you can reach on foot in 10, 20, and 30 minutes. Shade it by the contour minutes; blue marks the nearest, most-reachable ring.

rings = close.isochrone(
    lon = start_lon,
    lat = start_lat,
    mode = "walk",
    direction = "from",
    contours = [10, 20, 30],
    format = "geojson"
)
close_map(rings, fill = "contour")

Walk versus transit

The same starting point and the same 30-minute budget, on foot and by bus: the clearest way to see what transit buys you.

walk = close.isochrone(
    lon = start_lon,
    lat = start_lat,
    mode = "walk",
    direction = "from",
    minutes = 30,
    format = "geojson"
)
transit = close.isochrone(
    lon = start_lon,
    lat = start_lat,
    mode = "transit",
    direction = "from",
    minutes = 30,
    format = "geojson"
)

close_map(walk, color = "#058040")
close_map(transit, color = "#202a5b")