Skip to main content

geopy is a Python 2 and 3 client for several popular geocoding web services.

geopy makes it easy for Python developers to locate the coordinates of addresses, cities, countries, and landmarks across the globe using third-party geocoders and other data sources.

geopy includes geocoder classes for the ESRI ArcGIS, OpenStreetMap Nominatim, Google Geocoding API (V3), Yahoo! BOSS, geocoder.us, GeocodeFarm, and Bing Maps API geocoder services, as well as several other. The various geocoder classes are located in geopy.geocoders.

© GeoPy Project and individual contributors under the MIT License.

Installation

Using pip:

pip install geopy

Or, manually: download the tarball from PyPI, unzip, and execute this in the same directory:

python setup.py install

Geocoding

To geolocate a query to an address and coordinates:

>>> from geopy.geocoders import GoogleV3
>>> geolocator = GoogleV3()
>>> address, (latitude, longitude) = geolocator.geocode("175 5th Avenue NYC")
>>> print(address, latitude, longitude)
175 5th Avenue, New York, NY 10010, USA 40.7410262 -73.9897806

To find the address corresponding to a set of coordinates:

>>> from geopy.geocoders import GoogleV3
>>> geolocator = GoogleV3()
>>> address, (latitude, longitude) = geolocator.reverse("40.752067, -73.977578")
>>> print(address, latitude, longitude)
77 East 42nd Street, New York, NY 10017, USA 40.7520802 -73.9775683

Measuring Distance

Geopy can calculate geodesic distance between two points using the Vincenty distance or great-circle distance formulas, with a default of Vincenty available as the class geopy.distance.distance, and the computed distance available as attributes (e.g., miles, meters, etc.).

Here’s an example usage of Vincenty distance:

>>> from geopy.distance import vincenty
>>> newport_ri = (41.49008, -71.312796)
>>> cleveland_oh = (41.499498, -81.695391)
>>> vincenty(newport_ri, cleveland_oh).miles
538.3904451566326

Using great-circle distance:

>>> from geopy.distance import great_circle
>>> newport_ri = (41.49008, -71.312796)
>>> cleveland_oh = (41.499498, -81.695391)
>>> great_circle(newport_ri, cleveland_oh).miles
537.1485284062816

Changelog

1.0.0 - July 23rd, 2014

ADDED: Baidu Maps geocoder added. Contributed by Risent.

ADDED: Nominatim geocoder now supports structured queries. Contributed

by kpanic.

ADDED: Nominatim geocoder now supports a language parameter. Contributed

by Benjamin Henne.

CHANGED: GoogleV3’s geocode and reverse methods have different

orders for keyword argument parameters. Geocoders are now standardized on (query, exactly_one, timeout, …).

FIXED: Removed rounding of minutes which was causing a formatted point

to always have zero seconds. Contributed by Jonathan Batchelor.

Documentation

More documentation and examples can be found at Read the Docs.

Release files for geopy 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for geopy 1.0.0
File Size Uploaded
geopy-1.0.0.tar.gz 71.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for geopy 1.0.0
File Interpreter ABI Platform
geopy-1.0.0-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 116.4 kB

Release files / geopy-1.0.0.tar.gz

Download URL geopy-1.0.0.tar.gz
Size 71.9 kB
Tags Source
SHA-256 checksum
How to use checksums
b1f018d83cdb21fa9db2a185bd9b80f1125ee4e001717b21781f5587f1b70f18
BLAKE2b-256 checksum
How to use checksums
a0c7e77ecd30765b65b01fdf99ddfaf3b08ae1ca0fd15c3fd15b5adc694a18d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / geopy-1.0.0-py2.py3-none-any.whl

Download URL geopy-1.0.0-py2.py3-none-any.whl
Size 44.5 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
d4988c368a6588237c66667f7c0c1c317a59e23e00c72d99f2482a4e1e0b2292
BLAKE2b-256 checksum
How to use checksums
8a2550ae0a4da0951016ba118f92c85d47b7cade3a758c3a5b6f075034b6ba2e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

2.5.0

2 release files

2.4.1

2 release files

2.4.0

2 release files

2.3.0

2 release files

2.2.0

2 release files

2.1.0

2 release files

2.0.0

2 release files

1.23.0

2 release files

1.22.0

2 release files

1.20.0

2 release files

1.19.0

2 release files

1.18.1

2 release files

1.17.0

2 release files

1.16.0

2 release files

1.15.0

2 release files

1.14.0

2 release files

1.13.0

2 release files

1.12.0

2 release files

1.11.0

2 release files

1.9.1

2 release files

1.9.0

2 release files

1.8.1

1 release file

1.8.0

2 release files

1.7.1

2 release files

1.7.0

2 release files

1.6.1

2 release files

1.6.0

2 release files

1.5.0

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.5

2 release files

1.1.4

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.1

2 release files

This release

1.0.0 This release

2 release files

0.99

1 release file

0.98.3

1 release file

0.98.2

1 release file

0.98.1

1 release file

0.98

1 release file

0.97.1

1 release file

0.97

1 release file

0.96.3

1 release file

0.96.2

1 release file

0.96.1

1 release file

0.96.0

1 release file

0.95.1

1 release file

0.95

1 release file

0.94.2

1 release file

0.94.1

1 release file

0.94

3 release files

0.93

3 release files

0.92

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page