0

有什么功能可以转这个:

1600 Amphitheatre Parkway, Mountain View, CA":

进入这个:

1600+Amphitheatre+Parkway,+Mountain+View,+CA

使用他们的地理位置构建谷歌地图。

4

1 回答 1

1

您可以直接通过 '1600 Amphitheatre Parkway, Mountain View, CA' 使用关注功能

 public function GetGeoLocation($address)
        {
        // fetching lat&lng from Google Maps
        $request_uri = 'http://maps.googleapis.com/maps/api/geocode/xml?address='.urlencode($address).'&sensor=true';
        $google_xml = simplexml_load_file($request_uri);
        $lat = (string)$google_xml->result->geometry->location->lat;
        // fetching time from earth tools
        $lng = (string)$google_xml->result->geometry->location->lng;
        return array('lat' => $lat,'lng' => $lng)
        }

它将返回数组中地址的地理位置

于 2012-07-25T07:17:07.820 回答