简体   繁体   English

从邮政编码php获取gps坐标

[英]getting gps coordinates from zip code php

is there a way to get gps coordinates from a zip code in php? 有没有办法从php中的邮政编码获取gps坐标? for example, I have a mysql table with customers and their address and zip codes, I would like only to use the zip codes to generate the json file with gps coordinates, is something like that possible? 例如,我有一个包含客户及其地址和邮政编码的mysql表,我只想使用邮政编码生成具有gps坐标的json文件,是否可能? After that I would use that json file to show customers on google maps. 之后,我将使用该json文件在Google地图上显示客户。 thanks in advance 提前致谢

Google offers a geocoding api. Google提供了地理编码API。 Send an http request such as: 发送http请求,例如:

http://maps.googleapis.com/maps/api/geocode/json?address=55309&sensor=false

Where 55309 is your the desired zipcode. 其中55309是您所需的邮政编码。

Then you can parse the xml or json accordingly to get the longitude and latitude. 然后,您可以相应地解析xml或json以获取经度和纬度。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM