在我的申请表中,我得到了国家'和'邮政编码',使用这两个字段,我想得到'州名'和' City'或者'村名'。是否有任何API可用于获取这些信息。感谢
答案 0 :(得分:8)
您可以使用Google Geocoding API,简单的HTTP请求和JSON响应。
示例:http://maps.googleapis.com/maps/api/geocode/json?address=94085®ion=us
{
long_name: "California",
short_name: "CA",
types: [
"administrative_area_level_1",
"political"
]
}
但请注意,免费套餐仅支持:
答案 1 :(得分:5)
对于印度,您可以使用以下API
for short_repo in gh.repositories_by(username):
repo = short_repo.refresh()
if repo.fork:
parent = repo.parent
答案 2 :(得分:2)
可以帮助
https://www.whizapi.com/open-api/api-details?id=20
URL-> https://www.WhizAPI.com/api/v2/util/ui/in/indian-city-by-postal-code?AppKey=your-app-key&pin=110001
响应:
{
"ResponseCode": 0,
"ResponseMessage": "OK",
"ResponseDateTime": "11/10/2014 8:17:20 AM GMT",
"Data": [
{
"Pincode": "110001",
"Country": "INDIA",
"City": "Central Delhi",
"Address": "Baroda House"
},
{
"Pincode": "110001",
"Country": "INDIA",
"City": "Central Delhi",
"Address": "Bengali Market"
},
{
"Pincode": "110001",
"Country": "INDIA",
"City": "Central Delhi",
"Address": "Bhagat Singh Market"
},
{
"Pincode": "110001",
"Country": "INDIA",
"City": "Central Delhi",
"Address": "Connaught Place"
},
{
"Pincode": "110001",
"Country": "INDIA",
"City": "Central Delhi",
"Address": "Constitution House"
},
{
"Pincode": "110001",
"Country": "INDIA",
"City": "Central Delhi",
"Address": "Election Commission"
},
{
"Pincode": "110001",
"Country": "INDIA",
"City": "Central Delhi",
"Address": "Janpath"
},
{
"Pincode": "110001",
"Country": "INDIA",
"City": "Central Delhi",
"Address": "Krishi Bhawan"
},
{
"Pincode": "110001",
"Country": "INDIA",
"City": "Central Delhi",
"Address": "Lady Harding Medical College"
},
{
"Pincode": "110001",
"Country": "INDIA",
"City": "New Delhi",
"Address": "New Delhi G.P.O."
},
{
"Pincode": "110001",
"Country": "INDIA",
"City": "Central Delhi",
"Address": "North Avenue"
},
{
"Pincode": "110001",
"Country": "INDIA",
"City": "Central Delhi",
"Address": "Parliament House"
},
{
"Pincode": "110001",
"Country": "INDIA",
"City": "Central Delhi",
"Address": "Patiala House"
},
{
"Pincode": "110001",
"Country": "INDIA",
"City": "Central Delhi",
"Address": "Pragati Maidan Camp"
},
{
"Pincode": "110001",
"Country": "INDIA",
"City": "Central Delhi",
"Address": "Pragati Maidan"
},
{
"Pincode": "110001",
"Country": "INDIA",
"City": "Central Delhi",
"Address": "Rail Bhawan"
},
{
"Pincode": "110001",
"Country": "INDIA",
"City": "Central Delhi",
"Address": "Sansad Marg"
},
{
"Pincode": "110001",
"Country": "INDIA",
"City": "Central Delhi",
"Address": "Sansadiya Soudh"
},
{
"Pincode": "110001",
"Country": "INDIA",
"City": "Central Delhi",
"Address": "Secretariat North"
},
{
"Pincode": "110001",
"Country": "INDIA",
"City": "Central Delhi",
"Address": "Shastri Bhawan"
},
{
"Pincode": "110001",
"Country": "INDIA",
"City": "Central Delhi",
"Address": "Supreme Court"
}
]
}
答案 3 :(得分:1)
如果您使用Google地理编码器,则可以通过解析返回的json或xml并引用相应的字段来获取State和City。例如:
https://maps.googleapis.com/maps/api/geocode/json?address=94040
返回
{
"results" : [
{
"address_components" : [
{
"long_name" : "94040",
"short_name" : "94040",
"types" : [ "postal_code" ]
},
{
"long_name" : "Mountain View",
"short_name" : "Mountain View",
"types" : [ "locality", "political" ]
},
{
"long_name" : "Santa Clara County",
"short_name" : "Santa Clara County",
"types" : [ "administrative_area_level_2", "political" ]
},
{
"long_name" : "California",
"short_name" : "CA",
"types" : [ "administrative_area_level_1", "political" ]
},
...
答案 4 :(得分:0)
访问:https://developers.google.com/maps/documentation/geocoding/ 访问该网站,您将获得多个链接,您可以通过它获得不同的输出!!!
答案 5 :(得分:0)
您可以检查https://form-api.com
它支持包括印度在内的许多国家。