0
데모에서 위치 사람까지의지도를 사용합니다 geolocation map 내 문제는 데이터베이스에 좌표를 저장하고 싶지만 어떻게 알지 못합니다.codeIgniter Google지도 api V3 좌표
데모에서 위치 사람까지의지도를 사용합니다 geolocation map 내 문제는 데이터베이스에 좌표를 저장하고 싶지만 어떻게 알지 못합니다.codeIgniter Google지도 api V3 좌표
사용 구글과 위치를 인코딩 할 컬은 ... 여기 내가 작성하고 생산 현장에 지금 사용하고있는 한 예를 들어 함수이다 :
//$loc can be any kind of location from 555 street name, city, st, zip to just city, state, etc.
$loc = 'Austin, TX';
function get_geo_loc($loc) {
$string = str_replace (" ", "+", urlencode($loc));
$details_url = "http://maps.googleapis.com/maps/api/geocode/json?address=".$string."&sensor=false";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $details_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = json_decode(curl_exec($ch), true);
$lat = $response['results'][0]['geometry']['location']['lat'];
$lng = $response['results'][0]['geometry']['location']['lng'];
return array(
'lat' => $lat,
'lng' => $lng
);
}
더 정확하게 내 문제는 내가 얻을 수 있다는 것입니다 좌표는 내가 어디에 있는지 알 수 없습니다. – user3508275