我应该如何在我的应用程序集成谷歌地图


How should I integrate the google map in my application?

My Application是一个php程序,我只有地址名,没有地图上的协调。但是我发现google地图API需要协调来固定地址。我该怎么做呢?谢谢你!

我有地址:"觀塘% 20牛頭角% 20創業街202號% % 20美亞工業大廈% 202 202樓% % 20202室。它可以是搜索,并pin在谷歌地图应用程序,但当我使用谷歌api做地理编码,它显示我ZERO_RESULT:

http://maps.googleapis.com/maps/api/geocode/json?address=%E8%A7%80%E5%A1%98%20%E7%89%9B%E9%A0%AD%E8%A7%92%20%E5%89%B5%E6%A5%AD%E8%A1%97%202%E8%99%9F%20%E7%BE%8E%E4%BA%9E%E5%B7%A5%E6%A5%AD%E5%A4%A7%E5%BB%88&传感器= false

先把地址转换成斜线/斜线。您可以使用javascript或PHP(并将其缓存以备以后使用)来完成此操作。下面是一个简化的函数

function postcode_to_latlon($postcode){
    $xml = simplexml_load_file('http://maps.googleapis.com/maps/api/geocode/xml?sensor=false&address='.$postcode);
    $lat = $xml->result->geometry->location->lat;
    $lon = $xml->result->geometry->location->lng;
    return array($lat, $lon);
}

找不到地址。试着简化地址或改变一些东西,这样谷歌可能会更好地理解。还要检查地址字符串中的错误。