{"id":13419756,"url":"https://github.com/DenisCarriere/geocoder","last_synced_at":"2025-03-15T05:32:59.950Z","repository":{"id":13174570,"uuid":"15857755","full_name":"DenisCarriere/geocoder","owner":"DenisCarriere","description":":earth_asia: Python Geocoder","archived":false,"fork":false,"pushed_at":"2024-04-20T16:14:16.000Z","size":2192,"stargazers_count":1625,"open_issues_count":116,"forks_count":287,"subscribers_count":51,"default_branch":"master","last_synced_at":"2024-10-29T15:05:41.128Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://geocoder.readthedocs.org","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DenisCarriere.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS.rst","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-01-13T04:19:21.000Z","updated_at":"2024-10-27T21:27:35.000Z","dependencies_parsed_at":"2022-08-07T07:01:05.853Z","dependency_job_id":"0a59791f-b17f-48fe-bcd1-eb639cefaa64","html_url":"https://github.com/DenisCarriere/geocoder","commit_stats":{"total_commits":1109,"total_committers":78,"mean_commits":"14.217948717948717","dds":0.5238954012623985,"last_synced_commit":"39b9999ec70e61da9fa52fe9fe82a261ad70fa8b"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DenisCarriere%2Fgeocoder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DenisCarriere%2Fgeocoder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DenisCarriere%2Fgeocoder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DenisCarriere%2Fgeocoder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DenisCarriere","download_url":"https://codeload.github.com/DenisCarriere/geocoder/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243330259,"owners_count":20274037,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T22:01:20.410Z","updated_at":"2025-03-15T05:32:59.932Z","avatar_url":"https://github.com/DenisCarriere.png","language":"Python","funding_links":[],"categories":["Python","地理Geo处理"],"sub_categories":[],"readme":"\u003c!-- markdownlint-disable --\u003e\n\u003ch1 align=\"center\" style=\"margin:1em\"\u003e\n  \u003ca href=\"https://geocoder.readthedocs.org/\"\u003e\n    \u003cimg src=\"https://github.com/DenisCarriere/geocoder/raw/master/docs/_static/geocoder.png\"\n         alt=\"Markdownify\"\n         width=\"200\"\u003e\u003c/a\u003e\n  \u003cbr /\u003e\n  Python Geocoder\n\u003c/h1\u003e\n\n\u003ch4 align=\"center\"\u003e\n  Simple and consistent geocoding library written in Python.\n\u003c/h4\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"http://geocoder.readthedocs.io/?badge=master\"\u003e\n    \u003cimg src=\"https://readthedocs.org/projects/geocoder/badge/?version=master\"\n         alt=\"RDT\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://pypi.python.org/pypi/geocoder\"\u003e\n    \u003cimg src=\"https://img.shields.io/pypi/v/geocoder.svg\"\n         alt=\"PyPi\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://build.snapcraft.io/user/DenisCarriere/geocoder\"\u003e\n    \u003cimg src=\"https://build.snapcraft.io/badge/DenisCarriere/geocoder.svg\"\n         alt=\"Snap\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://travis-ci.org/DenisCarriere/geocoder\"\u003e\n    \u003cimg src=\"https://travis-ci.org/DenisCarriere/geocoder.svg?branch=master\"\n         alt=\"Travis\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://codecov.io/gh/DenisCarriere/geocoder\"\u003e\n    \u003cimg src=\"https://codecov.io/gh/DenisCarriere/geocoder/branch/master/graph/badge.svg\"\n         alt=\"Codecov\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\u003cbr\u003e\n\nTable of content\n----------------\n\n\u003c!-- TOC --\u003e\n\n- [Overview](#overview)\n- [A glimpse at the API](#a-glimpse-at-the-api)\n    - [Forward](#forward)\n    - [Multiple results](#multiple-results)\n    - [Reverse](#reverse)\n    - [House Addresses](#house-addresses)\n    - [IP Addresses](#ip-addresses)\n    - [Bounding Box](#bounding-box)\n- [Command Line Interface](#command-line-interface)\n- [Providers](#providers)\n- [Installation](#installation)\n    - [PyPi Install](#pypi-install)\n    - [GitHub Install](#github-install)\n    - [Snap Install](#snap-install)\n- [Feedback](#feedback)\n- [Contribution](#contribution)\n    - [Documenting](#documenting)\n    - [Coding](#coding)\n- [ChangeLog](#changelog)\n\n\u003c!-- /TOC --\u003e\n\n## Overview\n\nMany online providers such as Google \u0026 Bing have geocoding services,\nthese providers do not include Python libraries and have different\nJSON responses between each other.\n\nIt can be very difficult sometimes to parse a particular geocoding provider\nsince each one of them have their own JSON schema.\n\nHere is a typical example of retrieving a Lat \u0026 Lng from Google using Python,\nthings shouldn't be this hard.\n\n```python\n\u003e\u003e\u003e import requests\n\u003e\u003e\u003e url = 'https://maps.googleapis.com/maps/api/geocode/json'\n\u003e\u003e\u003e params = {'sensor': 'false', 'address': 'Mountain View, CA'}\n\u003e\u003e\u003e r = requests.get(url, params=params)\n\u003e\u003e\u003e results = r.json()['results']\n\u003e\u003e\u003e location = results[0]['geometry']['location']\n\u003e\u003e\u003e location['lat'], location['lng']\n(37.3860517, -122.0838511)\n```\n\nNow lets use Geocoder to do the same task\n\n```python\n\u003e\u003e\u003e import geocoder\n\u003e\u003e\u003e g = geocoder.google('Mountain View, CA')\n\u003e\u003e\u003e g.latlng\n(37.3860517, -122.0838511)\n```\n\n## A glimpse at the API\n\nMany properties are available once the geocoder object is created.\n\n### Forward\n\n```python\n\u003e\u003e\u003e import geocoder\n\u003e\u003e\u003e g = geocoder.google('Mountain View, CA')\n\u003e\u003e\u003e g.geojson\n\u003e\u003e\u003e g.json\n\u003e\u003e\u003e g.wkt\n\u003e\u003e\u003e g.osm\n```\n\n### Multiple queries ('batch' geocoding)\n\n```python\n\u003e\u003e\u003e import geocoder\n\u003e\u003e\u003e g = geocoder.mapquest(['Mountain View, CA', 'Boulder, Co'], method='batch')\n\u003e\u003e\u003e for result in g:\n...   print(result.address, result.latlng)\n...\n('Mountain View', [37.39008, -122.08139])\n('Boulder', [40.015831, -105.27927])\n```\n\n### Multiple results\n\n```python\n\u003e\u003e\u003e import geocoder\n\u003e\u003e\u003e g = geocoder.geonames('Mountain View, CA', maxRows=5)\n\u003e\u003e\u003e print(len(g))\n5\n\u003e\u003e\u003e for result in g:\n...   print(result.address, result.latlng)\n...\nMountain View ['37.38605', '-122.08385']\nMountain View Elementary School ['34.0271', '-117.59116']\nBest Western Plus Mountainview Inn and Suites ['51.79516', '-114.62793']\nBest Western Mountainview Inn ['49.3338', '-123.1446']\nMountain View Post Office ['37.393', '-122.07774']\n```\n\n\n\u003e The providers currently supporting multiple results are listed in the table [below](#providers).\n\n### Reverse\n\n```python\n\u003e\u003e\u003e g = geocoder.google([45.15, -75.14], method='reverse')\n\u003e\u003e\u003e g.city\n\u003e\u003e\u003e g.state\n\u003e\u003e\u003e g.state_long\n\u003e\u003e\u003e g.country\n\u003e\u003e\u003e g.country_long\n```\n\n### House Addresses\n\n```python\n\u003e\u003e\u003e g = geocoder.google(\"453 Booth Street, Ottawa ON\")\n\u003e\u003e\u003e g.housenumber\n\u003e\u003e\u003e g.postal\n\u003e\u003e\u003e g.street\n\u003e\u003e\u003e g.street_long\n```\n\n### IP Addresses\n\n```python\n\u003e\u003e\u003e g = geocoder.ip('199.7.157.0')\n\u003e\u003e\u003e g = geocoder.ip('me')\n\u003e\u003e\u003e g.latlng\n\u003e\u003e\u003e g.city\n```\n\n### Bounding Box\n\nAccessing the JSON \u0026 GeoJSON attributes will be different\n\n```python\n\u003e\u003e\u003e g = geocoder.google(\"Ottawa\")\n\u003e\u003e\u003e g.bbox\n{\"northeast\": [45.53453, -75.2465979], \"southwest\": [44.962733, -76.3539158]}\n\n\u003e\u003e\u003e g.geojson['bbox']\n[-76.3539158, 44.962733, -75.2465979, 45.53453]\n\n\u003e\u003e\u003e g.southwest\n[44.962733, -76.3539158]\n```\n\n## Command Line Interface\n\n```bash\n$ geocode \"Ottawa, ON\"  \u003e\u003e ottawa.geojson\n$ geocode \"Ottawa, ON\" \\\n    --provide google \\\n    --out geojson \\\n    --method geocode\n```\n\n## Providers\n\n| Provider                       | Optimal   | Usage Policy                    | Multiple results | Reverse | Proximity | Batch |\n|:-------------------------------|:----------|:--------------------------------|:-----------------|:--------|:----------|:------|\n| [ArcGIS][ArcGIS]               | World     |                                 | yes              | yes     |           |       |\n| [Baidu][Baidu]                 | China     | API key                         |                  | yes     |           |       |\n| [Bing][Bing]                   | World     | API key                         | yes              | yes     |           | yes   |\n| [CanadaPost][CanadaPost]       | Canada    | API key                         | yes              |         |           |       |\n| [FreeGeoIP][FreeGeoIP] This API endpoint is deprecated and will stop working on July 1st, 2018.         | World     | Rate Limit, [Policy][FreeGeoip-Policy]                |                  |         |           |       |\n| [Gaode][Gaode]                 | China     | API key                         |                  | yes     |           |       |\n| [Geocoder.ca][Geocoder.ca] (Geolytica) | CA \u0026 US | Rate Limit                |                  |         |           |       |\n| [GeocodeFarm][GeocodeFarm]     | World     | [Policy][GeocodeFarm-Policy]    | yes              | yes     |           |       |\n| [GeoNames][GeoNames]           | World     | Username                        | yes              |         | yes       |       |\n| [GeoOttawa][GeoOttawa]         | Ottawa    |                                 | yes              |         |           |       |\n| [Gisgraphy][Gisgraphy]         | World     | API key                         | yes              | yes     | yes       |       |\n| [Google][Google]               | World     | Rate Limit, [Policy][G-Policy]  | yes              | yes     | yes       |       |\n| [HERE][HERE]                   | World     | API key                         | yes              | yes     |           |       |\n| [IPInfo][IPInfo]               | World     | Rate Limit, [Plans][IP-Plans]   |                  |         |           |       |\n| [Komoot][Komoot] (OSM powered) | World     |                                 | yes              | yes     |           |       |\n| [LocationIQ][LocationIQ]       | World     | API Key                         | yes              | yes     |           |       |\n| [Mapbox][Mapbox]               | World     | API key                         | yes              | yes     | yes       |       |\n| [MapQuest][MapQuest]           | World     | API key                         | yes              | yes     |           | yes   |\n| [~~Mapzen~~][Mapzen]           | Shutdown  | API key                         | yes              | yes     |           |       |\n| [MaxMind][MaxMind]             | World     |                                 |                  |         |           |       |\n| [OpenCage][OpenCage]           | World     | API key                         | yes              | yes     |           |       |\n| [OpenStreetMap][OpenStreetMap] | World     | [Policy][OpenStreetMap-Policy]  | yes              | yes     |           |       |\n| [Tamu][Tamu]                   | US        | API key                         |                  |         |           |       |\n| [TGOS][TGOS]                   | Taiwan    |                                 |                  |         |           |       |\n| [TomTom][TomTom]               | World     | API key                         | yes              |         |           |       |\n| [USCensus][USCensus]           | US        |                                 |                  | yes     |           | yes   |\n| [What3Words][What3Words]       | World     | API key                         |                  | yes     |           |       |\n| [Yahoo][Yahoo]                 | World     |                                 |                  |         |           |       |\n| [Yandex][Yandex]               | Russia    |                                 | yes              | yes     |           |       |\n\n## Installation\n\n### PyPi Install\n\nTo install Geocoder, simply:\n\n```bash\n$ pip install geocoder\n...\n```\n\n### GitHub Install\n\nInstalling the latest version from Github:\n\n```bash\n$ git clone https://github.com/DenisCarriere/geocoder\n...\n$ cd geocoder\n$ python setup.py install\n...\n```\n\n### Snap Install\n\nTo install the stable geocoder [snap](https://snapcraft.io) in any of the [supported Linux distros](https://snapcraft.io/docs/core/install):\n\n```bash\n$ sudo snap install geocoder\n...\n```\n\nIf you want to help testing the latest changes from the master branch, you can install it from the edge channel:\n\n```bash\n$ sudo snap install geocoder --edge\n...\n```\n\nThe installed snap will be updated automatically every time a new version is pushed to the store.\n\n\n## Feedback\n\nPlease feel free to give any feedback on this module.\n\nSpeak up on Twitter [@DenisCarriere](https://twitter.com/DenisCarriere) and tell me how you use this Python Geocoder. New updates will be pushed to Twitter Hashtags [#python](https://twitter.com/search?q=%23python).\n\n## Contribution\n\nIf you find any bugs or any enhancements to recommend please send some of your comments/suggestions to the [Github Issues Page](https://github.com/DenisCarriere/geocoder/issues).\n\nSome way to contribute, from the most generic to the most detailed:\n\n### Documenting\n\nIf you are not comfortable with development, you can still contribute with the documentation.\n\n- review the documentation of a specific provider. Most of the time they are lacking details...\n- review the parameters for a specific method, compared to what is supported by the provider\n- review documentation for command line\n\nIf you miss any feature, just create an issue accordingly. Be sure to describe your use case clearly, and to provide links to the correct sources.\n\n### Coding\n\n- add support for a new provider. _Documentation TBD_, starting point possible with [wip_guide](https://geocoder.readthedocs.io/wip_guide.html).\n- extend methods for an existing support, i.e support an additionnal API). _Documentation TBD_\n- extend support of an existing API, i.e, support more (json) fields from the response, or more parameters. _Documentation TBD_\n\n\n## ChangeLog\n\nSee [CHANGELOG.md](./CHANGELOG.md)\n\n\n[TGOS]: http://geocoder.readthedocs.org/providers/TGOS.html\n[Mapbox]: http://geocoder.readthedocs.org/providers/Mapbox.html\n[Google]: http://geocoder.readthedocs.org/providers/Google.html\n[G-Policy]: https://developers.google.com/maps/documentation/geocoding/usage-limits\n[Bing]: http://geocoder.readthedocs.org/providers/Bing.html\n[LocationIQ]: http://geocoder.readthedocs.org/providers/LocationIQ.html\n[OpenStreetMap]: http://geocoder.readthedocs.org/providers/OpenStreetMap.html\n[OpenStreetMap-Policy]: https://operations.osmfoundation.org/policies/nominatim/\n[HERE]: http://geocoder.readthedocs.org/providers/HERE.html\n[TomTom]: http://geocoder.readthedocs.org/providers/TomTom.html\n[MapQuest]: http://geocoder.readthedocs.org/providers/MapQuest.html\n[OpenCage]: http://geocoder.readthedocs.org/providers/OpenCage.html\n[Yahoo]: http://geocoder.readthedocs.org/providers/Yahoo.html\n[ArcGIS]: http://geocoder.readthedocs.org/providers/ArcGIS.html\n[Yandex]: http://geocoder.readthedocs.org/providers/Yandex.html\n[Geocoder.ca]: http://geocoder.readthedocs.org/providers/Geocoder-ca.html\n[Baidu]: http://geocoder.readthedocs.org/providers/Baidu.html\n[GeoOttawa]: http://geocoder.readthedocs.org/providers/GeoOttawa.html\n[FreeGeoIP]: http://geocoder.readthedocs.org/providers/FreeGeoIP.html\n[FreeGeoip-Policy]: https://github.com/apilayer/freegeoip#readme\n[MaxMind]: http://geocoder.readthedocs.org/providers/MaxMind.html\n[Mapzen]: https://mapzen.com/blog/shutdown\n[What3Words]: http://geocoder.readthedocs.org/providers/What3Words.html\n[CanadaPost]: http://geocoder.readthedocs.org/providers/CanadaPost.html\n[GeoNames]: http://geocoder.readthedocs.org/providers/GeoNames.html\n[IPInfo]: http://geocoder.readthedocs.org/providers/IPInfo.html\n[Tamu]: http://geoservices.tamu.edu/Services/Geocode/WebService/\n[GeocodeFarm]: https://geocode.farm/\n[GeocodeFarm-Policy]: https://geocode.farm/geocoding/free-api-documentation/\n[Gaode]: http://geocoder.readthedocs.org/providers/.html\n[IP-Plans]: http://ipinfo.io/pricing\n[Komoot]: http://photon.komoot.de\n[USCensus]: https://geocoding.geo.census.gov/geocoder/Geocoding_Services_API.html\n[Gisgraphy]: https://premium.gisgraphy.com/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDenisCarriere%2Fgeocoder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FDenisCarriere%2Fgeocoder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDenisCarriere%2Fgeocoder/lists"}