Nearest Zip Code Search using asp.net

老子叫甜甜 提交于 2019-11-28 10:55:46

问题


I want to inplement functionallity that will search zip codes, if user enter any zip code than all the zip codes close to entered zip code will be shown. Please let us know if there is any free api for it like Google API or any other solutions.


回答1:


First, grab a free zip code database like this one. This will allow you to convert from an entered zip code to a latitude and longitude. As long as you make latitude and longitude database keys also, you can now look up all the nearby latitudes and longitudes (by moving up and down in the sorted values) and get all ZIP codes within a desired distance.

Here is an example of how to calculate latitude and longitude distances.




回答2:


I haven't explored it much, but the USPS offers a number of API's and databases. You might want to check out their Address Information API. If anyone has an accurate database, it's probably the USPS.

https://www.usps.com/business/webtools.htm

They have some web tools that allow you to manually look up zip codes for a city, so there might be similar functionality you can use.




回答3:


I work in the address verification field, where we have some experience doing this) where "ZIP codes" and "geocoding" are buzz-words. For further location accuracy, you will want to consider verifying a complete address and adding the ZIP+4 code. This will provide more relevant results to your user.

Generally, free services won't provide that kind of value, but there are some affordable options that are officially licensed, or certified, by the USPS, to distribute that data. One such service is LiveAddress (a service I've worked on myself). The ZIP+4 code is more accurate than a generic ZIP code, so you'll get more accurate geolocated results.



来源:https://stackoverflow.com/questions/6922195/nearest-zip-code-search-using-asp-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!