Geocoding is the process of taking input text, such as an address or the name of a place, and returning a latitude/longitude location. To put it simply, Geocoding is converting physical address to latitude and longitude.
地理编码是获取输入文本(例如地址或地点名称)并返回纬度/经度位置的过程。 简而言之,地理编码会将物理地址转换为纬度和经度。
There are many geocoding API options available in python. Some of the popular ones are GeoPy, OpenCage geocoder, google geocoding. Geopy is one of the few API services which provides unlimited access for non-commercial use. For Google API and OpenCage geocoders, there is a limit of 2500 requests per/day. Using geopy, the latitudes and longitudes for some addresses in my dataset, showed different countries instead of the US. With OpenCage geocoder, surprisingly all the addresses were accurate so I used OpenCage encoder.
python中提供了许多地理编码API选项。 一些受欢迎的是GeoPy,OpenCage地理编码器,google地理编码。 Geopy是为非商业用途提供无限访问的少数API服务之一。 对于Google API和OpenCage地理编码器,每天限制为2500个请求。 使用geopy,我的数据集中某些地址的经度和纬度显示了不同的国家,而不是美国。 使用OpenCage 地理编码器时 ,令人惊讶的是所有地址都是准确的,因此我使用了OpenCage编码器。
使用OpenCage地理编码器和熊猫 (Working with OpenCage geocoder and pandas)
To use OpenCage Geocoder in python, the python library should be installed first using pip install opencage
.More info about this library can be found here: OpenCageGeocode on Github
要在python中使用OpenCage Geocoder,应首先使用pip install opencage
安装python库。有关此库的更多信息,请参见: Github上的OpenCageGeocode
Once the library is installed, you will need an OpenCage geocoder account to generate an API key. A free account can be created using opencagedata.com. Once you signup for an account you can find API keys in Dashboard as shown in the below image.
安装库后,您将需要一个OpenCage地理编码器帐户来生成API密钥。 可以使用opencagedata.com创建免费帐户。 注册帐户后,即可在仪表板中找到API密钥,如下图所示。