1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| >>> import json, logging >>> from geopy.geocoders import Nominatim >>> geolocator = Nominatim() >>> location = geolocator.reverse("39.90733345,116.391244079988") >>> print location.address 天安门, 1, 西长安街, 崇文, 北京市, 东城区, 北京市, 100010, 中国 >>> print json.dumps(location.raw, indent=4, ensure_ascii=False, encoding='utf8') { "display_name": "天安门, 1, 西长安街, 崇文, 北京市, 东城区, 北京市, 100010, 中国", "place_id": "74005413", "lon": "116.391244079988", "boundingbox": [ "39.9072273", "39.9075343", "116.3906566", "116.3918428" ], "osm_type": "way", "licence": "Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright", "osm_id": "25097203", "lat": "39.90733345", "address": { "building": "天安门", "city": "北京市", "house_number": "1", "country": "中国", "suburb": "东城区", "state": "北京市", "postcode": "100010", "country_code": "cn", "road": "西长安街" } }
|