2012-02-28 3 views
0

위도는 주소가 주어진 경도 & 위도를 생성하므로 Google 지오 코딩 API가 우수하다고 생각했습니다.Google 지오 코딩 API에서 위도와 경도 검색

나는 모든 것을 시도했지만 여전히 작동하지 않습니다. 나는 경험 많은 웹 프로그래머가 아니므로 도움이 될 것입니다.

저는 XML과 JSON, JavaScript 및 ASP에서 시도했지만 아무것도 사용하지 않았습니다. 나는이 ASP와 함께, 내가 할 수있는 최선되는 XML/JSON 개체 :(

을 볼 수 없습니다.

는 적어도 내가 서버에서 데이터를 얻을 수 있습니다 보인다 여기
<% 
address=Request.QueryString("address") 
url = "http://maps.googleapis.com/maps/api/geocode/json?address=" 
url = url + address + "&sensor=false" 
set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP") 
xmlhttp.open "GET", url, false 
xmlhttp.send "" 

data = xmlhttp.responseText 
Response.write data 
' Creating the XML object (New code added) : 
set xml = xmlhttp.responseXML 
Response.write xml.documentElement.selectSingleNode("result").text 

set xmlhttp = nothing 
%> 

그러나, 나는 (XML에를 제공하기 위해 서버를 요구하거나 XML)을 JSON 개체의 정보를 변환 할 수 없습니다.

을 누군가가 ASP 나 자바 스크립트, JSON 또는 XML을, 그것을 수행하는 방법을 알고 있다면, 나는 매우 감사 할 것입니다.

답변

0

좋아, 친구와 좀 더 reasearch 후, 우리는로했습니다 마지막으로 수행 :

ASP에서

, 키는

selectSingleNode("name of your node") 

childNodes(integer pointing to the node) 

와 놀고있다 그래서 당신은 내부 노드를 선택할 수 있습니다

set xml = xmlhttp.responseXML 
Response.write xml.documentElement.selectSingleNode("result").selectSingleNode("geometry").selectSingleNode("location").text 
012 :

따라서 노드 등 내부 노드는 질문에 말했듯이 객체를 생성 한 후, 당신은 할 필요가

예를 들어, 위도가 & 인 경우 찾고 있습니다.

+1

위대한, 내 자신의 답변을 받아 들일 수 없으므로이 결과는 닫히고 검색 결과에 나타나지 않습니까? –

+1

내일 것입니다. 당신의 자신의 대답을 수락하기 전에 2 일을 기다리는 것) – ArcDare

+1

'sele ctSingleNode'는 인수로 XPath 표현식을 사용하므로 표현식을'xml.documentElement.selectSingleNode ("result/geometry/location"). text' –

0

다음은 PHP로 변환하는 방법입니다. ASP로 변환하면됩니다.

$XML = file_get_contents("http://maps.google.com/maps/geo?q=$address&output=xml&oe=utf8&sensor=false&key=$mapskey"); 

if (preg_match('/<coordinates>([\d.-]*),([\d.-]*),0<\/coordinates>/', $XML, $matches)) { 
    $longitude = $matches[1]; 
    $latitude = $matches[2]; 
} 
+1

나는 그것을 시도거야, 하지만 PHP에 익숙하지 않은 분은 약간의 시간이 걸릴 것입니다. 감사합니다. – ArcDare