Geocoding¶
geopandas
supports geocoding (i.e., converting place names to
location on Earth) through geopy, an optional dependency of geopandas
.
The following example shows how to use the Google geocoding API to get the
locations of boroughs in New York City, and plots those locations along
with the detailed borough boundary file included within geopandas
.
In [1]: boros = geopandas.read_file(geopandas.datasets.get_path("nybb"))
In [2]: boros.BoroName
Out[2]:
0 Staten Island
1 Queens
2 Brooklyn
3 Manhattan
4 Bronx
Name: BoroName, dtype: object
In [3]: boro_locations = geopandas.tools.geocode(boros.BoroName, provider="google")