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.pswp.cn/news/389238.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/389238.shtml
英文地址,請注明出處:http://en.pswp.cn/news/389238.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

js進階 12-5 jquery中表單事件如何使用

js進階 12-5 jquery中表單事件如何使用 一、總結 一句話總結&#xff1a;表單事件如何使用&#xff1a;可元素添加事件監聽&#xff0c;然后監聽元素&#xff0c;和javase里面一樣。 1、表單獲取焦點和失去焦點事件有哪兩組&#xff1f; 注意是blur/focus和focus in/out&#x…

SiamBAN論文學習

SiameseBAN論文來源論文背景主要貢獻論文分析網絡框架創新點一&#xff1a;Box Adaptive Head創新點二&#xff1a;Ground-truth創新點三&#xff1a;Anchor Free論文流程訓練部分&#xff1a;跟蹤部分論文翻譯Abstract1. Introduction2. Related Works2.1. Siamese Network Ba…

簡單入門Javascript正則表達式

我們已經會熟練使用js字符串類型了&#xff0c;例如你想知道一個變量是否等于一個字符串&#xff0c;可能可能這樣判斷 if(ahello,world){... } 復制代碼但是往往我們有時候對一些字符串判斷顯得力不從心&#xff0c;例如判斷一個文件的類型是否為js類型&#xff0c;可能有下面…

實現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# .net

/// <summary> /// 發送郵件 /// </summary> /// <param name"SendTo">發送人的地址</param> /// <param name"MyEmail">我的Email地址</param> /// <param name"SendTit…

簡明易懂的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…

計算機科學期刊_成為數據科學家的五種科學期刊

計算機科學期刊The field of data science is advancing at an incredible pace. New scientific articles are published daily. As a student, I try to stay up-to-date with the scientific literature that is published. In this blog post, I created a list of scienti…

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。自己曾寫過一個只能過樣例的。都放上來吧。 路徑壓縮的…

區塊鏈的模型結構

關于區塊鏈的模型結構問題&#xff0c;行業內已經談論千萬遍了&#xff0c;基本上已經成為一種定義式的問題了。總體上來看&#xff0c;區塊鏈的基礎架構可以分為六層&#xff0c;包括數據層、網絡層、共識層、激勵層、合約層、應用層。每一層分別完成一項核心的功能&#xff0…

數據科學家 數據工程師_數據科學家應該對數據進行版本控制的4個理由

數據科學家 數據工程師While working in a software project it is very common and, in fact, a standard to start right away versioning code, and the benefits are already pretty obvious for the software community: it tracks every modification of the code in a p…

JDK 下載相關資料

所有版本JDK下載地址&#xff1a; http://www.oracle.com/technetwork/java/archive-139210.html 下載賬戶密碼&#xff1a; 2696671285qq.com Oracle123 轉載于:https://www.cnblogs.com/bg7c/p/9277729.html