Files
geopandas/doc/source/docs/user_guide/geocoding.rst
T
Murat Can ÜsteandMartin Fleischmann e2c5b0d978 DOC: Relevant API links for intersphinx mapping (#1931)
* DOC: added API links to intersphinx mapping

* DOC: updated mergingdata.rst links

* DOC: updated aggregation_with_dissolve.rst links

* DOC: updated data_structures.rst links

* DOC: updated geocoding.rst links

* DOC: updated geometric_manipulations.rst links

* DOC: updated indexing.rst links

* DOC: updated io.rst links

* DOC: updated projections.rst links

* DOC: updated set_operations.rst links

* DOC: updated mapping.rst links

* DOC: updated missing_empty.rst links

* DOC: updated geoplot intersphinx links

* DOC: make 'unary_union' attr instead of method

Co-authored-by: Martin Fleischmann <martin@martinfleischmann.net>

* DOC: remove link to GeoDataFrame.geometry

Co-authored-by: Martin Fleischmann <martin@martinfleischmann.net>

* DOC: convert pandas indexers to attrs instead of methods

Co-authored-by: Martin Fleischmann <martin@martinfleischmann.net>

* DOC: convert indexer 'cx' to attr instead of method

Co-authored-by: Martin Fleischmann <martin@martinfleischmann.net>

* DOC: refer GeoSeries.buffer instead of shapely buffer

Co-authored-by: Martin Fleischmann <martin@martinfleischmann.net>

* DOC: make 'unary_union' attr instead of method on missing_empty.rst

Co-authored-by: Martin Fleischmann <martin@martinfleischmann.net>

* DOC: refer to DataFrame.merge instead of pandas.merge

Co-authored-by: Martin Fleischmann <martin@martinfleischmann.net>

* DOC: link pyproj.CRS

* DOC: changed API links to 'stable' from 'latest'

* DOC: fixed separator length

* DOC: uppercase CRS in pyproj.crs

Co-authored-by: Martin Fleischmann <martin@martinfleischmann.net>
2021-05-28 11:16:54 +01:00

60 lines
2.0 KiB
ReStructuredText

.. currentmodule:: geopandas
.. ipython:: python
:suppress:
import geopandas
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 get the
locations of boroughs in New York City, and plots those locations along
with the detailed borough boundary file included within ``geopandas``.
.. _geopy: http://geopy.readthedocs.io/
.. ipython:: python
boros = geopandas.read_file(geopandas.datasets.get_path("nybb"))
boros.BoroName
boro_locations = geopandas.tools.geocode(boros.BoroName)
boro_locations
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
boros.to_crs("EPSG:4326").plot(ax=ax, color="white", edgecolor="black");
@savefig boro_centers_over_bounds.png
boro_locations.plot(ax=ax, color="red");
By default, the :func:`~geopandas.tools.geocode` function uses the
`GeoCode.Farm geocoding API <https://geocode.farm/>`__ with a rate limitation
applied. But a different geocoding service can be specified with the
``provider`` keyword.
The argument to ``provider`` can either be a string referencing geocoding
services, such as ``'google'``, ``'bing'``, ``'yahoo'``, and
``'openmapquest'``, or an instance of a :mod:`Geocoder <geopy.geocoders>` from :mod:`geopy`. See
``geopy.geocoders.SERVICE_TO_GEOCODER`` for the full list.
For many providers, parameters such as API keys need to be passed as
``**kwargs`` in the :func:`~geopandas.tools.geocode` call.
For example, to use the OpenStreetMap Nominatim geocoder, you need to specify
a user agent:
.. code-block:: python
geopandas.tools.geocode(boros.BoroName, provider='nominatim', user_agent="my-application")
.. attention::
Please consult the Terms of Service for the chosen provider. The example
above uses ``'geocodefarm'`` (the default), for which free users are
limited to 250 calls per day and 4 requests per second
(`geocodefarm ToS <https://geocode.farm/geocoding/free-api-documentation/>`_).