How should I integrate the google map in my application?
My Application is a php program, and I only have the address name, instead of the coordination on the map. But I find that the google map API requires the coordination to pin the address. How can I do so? Thank you.
I have the address:'觀塘%20牛頭角%20創業街%202號%20美亞工業大廈%202樓%202A%20202室'. It can be search, and pin on the google map application, but when I using the google api to do geocoding, it shows me ZERO_RESULT:
http://maps.googleapis.com/maps/api/geocode/开发者_如何学Gojson?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&sensor=false
Just convert the address into lat/lon first. You can either do this using javascript or you can use PHP (and cache it for later). Here is a simplified function to do that for you
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);
}
This process is called geocoding.
The address can't be found then. Try simplifying the address or switching things around so maybe Google will understand better. Also check for mistakes in your address string.
精彩评论