api地理编码_通过地理编码API使您的数据更有意义

api地理编码

Motivation

动机

In my second semester of my Master’s degree, I was working on a dataset which had all the records of the road accident in Victoria, Australia (2013-19). I was very curious to know, which national highways are the most dangerous in Victoria, and need attention to improve safety. The dataset did have the longitude and latitude coordinates where the accidents occurred, but it did not have other supporting and useful information like the name of roads where the accident took place, or the suburb, LGA etc. So I thought there must be a way to retrieve that information and analyse it, since its all geographic information which should be linked to the location coordinates. The answer was extracting the information through the process of reverse-geocoding.

在攻读硕士学位的第二学期,我正在研究一个数据集,其中包含澳大利亚维多利亚州(2013-19年)道路交通事故的所有记录。 我很好奇,维多利亚州哪些国道最危险,需要注意以提高安全性。 该数据集确实具有发生事故的经度纬度坐标,但是它没有其他支持和有用的信息,例如发生事故的道路名称,郊区,LGA等。因此,我认为必须有一种方法检索并分析该信息,因为应该将所有地理信息链接到位置坐标。 答案是通过反向地理编码来提取信息

What does Geocoding/Reverse-geocoding mean?

地理编码/反向地理编码是什么意思?

Geocoding is the process of converting addresses (like “1600 Amphitheatre Parkway, Mountain View, CA”) into geographic coordinates (like latitude 37.423021 and longitude -122.083739). This might be very useful if your planning to visualise the concentration of your data points in a map. Reverse geocoding is the process of converting geographic coordinates into a human-readable address. If you have good wrangling skills, you can extract other useful information like the nearby street/highway, district area or a landmark.

地理编码是将地址(如“ 1600 Amphitheatre Parkway,Mountain View,CA”)转换为地理坐标(如纬度37.423021和经度-122.083739)的过程。 如果您计划可视化地图中数据点的集中度,这可能非常有用。 反向地理编码是将地理坐标转换为人类可读地址的过程。 如果您有良好的摔跤技巧,则可以提取其他有用的信息,例如附近的街道/高速公路,地区或地标。

My aim was to use reverse-geocoding to extract the name of the highways on which those accidents occurred. There are many platforms available for geocoding, but I used the Google Maps Platform. It is one of the best platforms available which gives you accurate and detailed information. It also offers free services for up to 100,000 requests.

我的目的是使用反向地理编码来提取发生这些事故的高速公路的名称。 有许多可用于地理编码的平台,但是我使用了Google Maps Platform。 它是可为您提供准确和详细信息的最佳平台之一。 它还为多达100,000个请求提供免费服务。

Implementation for Reverse-Geocoding

反向地理编码的实现

I have used python here to implement reverse-geocoding.

我在这里使用python来实现反向地理编码。

Step 1: — Get your Google API Key and enable Geocoding API service. You can refer to this YouTube link to help you set it up.

步骤1:—获取您的Google API密钥并启用地址解析API服务。 您可以参考此YouTube 链接来帮助您进行设置。

Step 2: — Use the reverse_geocode function which converts the location coordinates and receives API output.

步骤2:—使用reverse_geocode函数转换位置坐标并接收API输出。

Remember you have to the input the location coordinates as a tuple. I have provided a screenshot of my implementation which converts 10 location coordinates and retrieves information in JSON format about the region via the API.

记住,您必须以元组的形式输入位置坐标。 我提供了实现的屏幕截图,该屏幕截图可转换10个位置坐标,并通过API以JSON格式检索有关该区域的信息。

Image for post
Fig 2 Code Snippet
图2代码段

Note: For geocoding you have to use the ‘geocode(<address>)’ method. The result should be stored in a list of size 2.

注意:对于地理编码,您必须使用'geocode(<address>)'方法。 结果应存储在大小为2的列表中。

Step3: — Extracting the information in the API output to get the required information.

步骤3:—在API输出中提取信息以获取所需的信息。

This is perhaps the trickiest part of the implementation especially in reverse geocoding. There is a lot of information retrieved and you might need to wrangle the data you want before any analysis. Here’s how the output of one set of location coordinates i.e. (-37.81125,144.93391) in the above data frame looks like: -

这可能是实现过程中最棘手的部分,尤其是在反向地理编码中。 检索到很多信息,您可能需要在进行任何分析之前先整理所需的数据。 这是上述数据框中的一组位置坐标即(-37.81125,144.93391)的输出如下所示:-

Image for post
Fig 3 JSON output
图3 JSON输出

As you can clearly see in the output, the accident occurred on the ‘City Link’ Highway in Victoria.

从输出中可以清楚地看到,事故发生在维多利亚州的“ City Link”高速公路上。

The problem I faced here was that the API output from all the accident records was not always in the same format as above. Many of them had different information put in different places. Hence I had to use my wrangling skills to extract the required information from each response.

我在这里遇到的问题是,所有事故记录的API输出并不总是与上述格式相同。 他们中许多人在不同的地方放置了不同的信息。 因此,我不得不使用自己的争吵技巧从每个响应中提取所需的信息。

So, I came up with the idea of extracting the route number of the highway instead of the name on which the accidents occurred. The highways in Victoria are numbered in the pattern starting with ‘M’ and a number. For example, M2 here is the ‘City Link Highway’ or also known as the Western Link. This format was very easy to extract using ‘re’ package of python since it followed a definite pattern. After the extraction, I was easily able to convert these codes to their respective Highway names. I have provided an illustration of that code as well.

因此,我想到了提取高速公路的路线号而不是事故发生的名称的想法。 维多利亚州的高速公路以“ M”和一个数字开头。 例如,这里的M2是“城市链接高速公路”或也称为“西方链接”。 这种格式很容易使用python的“ re”包提取,因为它遵循确定的模式。 提取后,我可以轻松地将这些代码转换为各自的公路名称。 我也提供了该代码的说明。

Note: You can also access the data through the JSON hierarchy, but then again it might not be the same always.

注意:您也可以通过JSON层次结构访问数据,但是同样,它也不一定总是相同的

Image for post
Fig 4 Code Snippet
图4代码段

Mission Accomplished!

任务完成!

I personally really enjoyed the process of getting more information to support my analysis of the data set. It gave me deeper insights and understanding of the frequency of road accidents taking place in Victoria. Many times the information is not as detailed as you would expect and you will have to merge other data sets to get more value out of your main data set. If the above explanations are not clear, do reach out to me via Linkedin & I will be happy to assist you. Thank You!

我个人真的很喜欢获得更多信息以支持我对数据集进行分析的过程。 它使我对维多利亚州发生道路交通事故的频率有了更深刻的了解和理解。 很多时候,信息没有您期望的那么详细,您将不得不合并其他数据集以从主数据集中获得更多价值。 如果以上解释不清楚,请通过Linkedin与我联系,我们很乐意为您提供帮助。 谢谢!

翻译自: https://medium.com/swlh/making-more-sense-of-your-data-through-geocoding-api-3bcbc609c993

api地理编码

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/389238.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

SiamBAN论文学习

SiameseBAN论文来源论文背景主要贡献论文分析网络框架创新点一&#xff1a;Box Adaptive Head创新点二&#xff1a;Ground-truth创新点三&#xff1a;Anchor Free论文流程训练部分&#xff1a;跟踪部分论文翻译Abstract1. Introduction2. Related Works2.1. Siamese Network Ba…

实现klib_使用klib加速数据清理和预处理

实现klibTL;DRThe klib package provides a number of very easily applicable functions with sensible default values that can be used on virtually any DataFrame to assess data quality, gain insight, perform cleaning operations and visualizations which results …

MMDetection修改代码无效

最近在打比赛&#xff0c;使用MMDetection框架&#xff0c;但是无论是Yolo修改类别还是更改head&#xff0c;代码运行后发现运行的是修改之前的代码。。。也就是说修改代码无效。。。 问题解决办法&#xff1a; MMDetection在首次运行后会把一部分运行核心放在anaconda的环境…

docker etcd

etcd是CoreOS团队于2013年6月发起的开源项目&#xff0c;它的目标是构建一个高可用的分布式键值(key-value)数据库&#xff0c;用于配置共享和服务发现 etcd内部采用raft协议作为一致性算法&#xff0c;etcd基于Go语言实现。 etcd作为服务发现系统&#xff0c;有以下的特点&…

SpringBoot简要

2019独角兽企业重金招聘Python工程师标准>>> 简化Spring应用开发的一个框架&#xff1b;      整个Spring技术栈的一个大整合&#xff1b;      J2EE开发的一站式解决方案&#xff1b;      自动配置&#xff1a;针对很多Spring应用程序常见的应用功能&…

简明易懂的c#入门指南_统计假设检验的简明指南

简明易懂的c#入门指南介绍 (Introduction) One of the main applications of frequentist statistics is the comparison of sample means and variances between one or more groups, known as statistical hypothesis testing. A statistic is a summarized/compressed proba…

Torch.distributed.elastic 关于 pytorch 不稳定

错误日志&#xff1a; Epoch: [229] Total time: 0:17:21 Test: [ 0/49] eta: 0:05:00 loss: 1.7994 (1.7994) acc1: 78.0822 (78.0822) acc5: 95.2055 (95.2055) time: 6.1368 data: 5.9411 max mem: 10624 WARNING:torch.distributed.elastic.agent.server.api:Rec…

0x22 迭代加深

poj2248 真是个新套路。还有套路剪枝...大到小和判重 #include<cstdio> #include<iostream> #include<cstring> #include<cstdlib> #include<algorithm> #include<cmath> #include<bitset> using namespace std;int n,D,x[110];bool…

云原生全球最大峰会之一KubeCon首登中国 Kubernetes将如何再演进?

雷锋网消息&#xff0c;11月14日&#xff0c;由CNCF发起的云原生领域全球最大的峰会之一KubeConCloudNativeCon首次登陆中国&#xff0c;中国已经成为云原生领域一股强大力量&#xff0c;并且还在不断成长。 毫无疑问&#xff0c;Kubernetes已经成为容器编排事实标准&#xff…

分布分析和分组分析_如何通过群组分析对用户进行分组并获得可行的见解

分布分析和分组分析数据分析 (DATA ANALYSIS) Being a regular at a restaurant is great.乙 eing定期在餐厅是伟大的。 When I started university, my dad told me I should find a restaurant I really liked and eat there every month with some friends. Becoming a reg…

python 工具箱_Python交易工具箱:通过指标子图增强图表

python 工具箱交易工具箱 (trading-toolbox) After a several months-long hiatus, I can finally resume posting to the Trading Toolbox Series. We started this series by learning how to plot indicators (specifically: moving averages) on the top of a price chart.…

PDA端的数据库一般采用的是sqlce数据库

PDA端的数据库一般采用的是sqlce数据库,这样与PC端的sql2000中的数据同步就变成了一个问题,如在PDA端处理,PDA端的内存,CPU等都是一个制约因素,其次他们的一个连接稳定及其间的数据传输也是一个难点.本例中通过在PC端的转化后再复制到PDA上面,这样,上面所有的问题都得到了一个有…

bzoj 1016 [JSOI2008]最小生成树计数——matrix tree(相同权值的边为阶段缩点)(码力)...

题目&#xff1a;https://www.lydsy.com/JudgeOnline/problem.php?id1016 就是缩点&#xff0c;每次相同权值的边构成的联通块求一下matrix tree。注意gauss里的编号应该是从1到...的连续的。 学习了一个TJ。用了vector。自己曾写过一个只能过样例的。都放上来吧。 路径压缩的…

商米

2019独角兽企业重金招聘Python工程师标准>>> 今天看了一下商米的官网&#xff0c;发现他家的东西还真的是不错。有钱了&#xff0c;想去体验一下。 如果我妹妹还有开便利店的话&#xff0c;我会推荐他用这个。小巧便捷&#xff0c;非常方便。 转载于:https://my.osc…

python交互式和文件式_使用Python创建和自动化交互式仪表盘

python交互式和文件式In this tutorial, I will be creating an automated, interactive dashboard of Texas COVID-19 case count by county using python with the help of selenium, pandas, dash, and plotly. I am assuming the reader has some familiarity with python,…

不可不说的Java“锁”事

2019独角兽企业重金招聘Python工程师标准>>> 前言 Java提供了种类丰富的锁&#xff0c;每种锁因其特性的不同&#xff0c;在适当的场景下能够展现出非常高的效率。本文旨在对锁相关源码&#xff08;本文中的源码来自JDK 8&#xff09;、使用场景进行举例&#xff0c…

数据可视化 信息可视化_可视化数据以帮助清理数据

数据可视化 信息可视化The role of a data scientists involves retrieving hidden relationships between massive amounts of structured or unstructured data in the aim to reach or adjust certain business criteria. In recent times this role’s importance has been…

seaborn添加数据标签_常见Seaborn图的数据标签快速指南

seaborn添加数据标签In the course of my data exploration adventures, I find myself looking at such plots (below), which is great for observing trend but it makes it difficult to make out where and what each data point is.在进行数据探索的过程中&#xff0c;我…

使用python pandas dataframe学习数据分析

⚠️ Note — This post is a part of Learning data analysis with python series. If you haven’t read the first post, some of the content won’t make sense. Check it out here.Note️ 注意 -这篇文章是使用python系列学习数据分析的一部分。 如果您还没有阅读第一篇文…

无向图g的邻接矩阵一定是_矩阵是图

无向图g的邻接矩阵一定是To study structure,tear away all flesh soonly the bone shows.要研究结构&#xff0c;请尽快撕掉骨头上所有的肉。 Linear algebra. Graph theory. If you are a data scientist, you have encountered both of these fields in your study or work …