지도/로컬 API에 대한 문의게시판입니다.
기존 다음api 종료로 카카오 api 계정 새로발급받아서 소스에 적용중입니다.
아래 참부한 소스에서GetResponse() 에서 에러발생합니다.
경로에 잘못된문자가 있습니다.라고 하네요
requestUrl
//dapi.kakao.com/v2/local/geo/transcoord?appkey=앱키&x=402097.23&y=264729.47&fromCoord=TM&toCoord=WGS84&output=xml
키값은 rest api 써야하는 아님 자바스크립트 api 써야하는지도 문의드립니다.![에러발생|690x414]
public String[] coordinateChange(double latitude, double longitude)
{
//String requestUrl = "http://apis.daum.net/local/geo/transcoord";
//requestUrl += "?apikey=" + "앱키";
String requestUrl = "//dapi.kakao.com/v2/local/geo/transcoord";
requestUrl += "?appkey=" + "앱키";
requestUrl += "&x=" + latitude;
requestUrl += "&y=" + longitude;
requestUrl += "&fromCoord=" + "TM";
requestUrl += "&toCoord=" + "WGS84";
requestUrl += "&output=" + "xml";
System.Net.WebRequest wr = System.Net.WebRequest.Create(requestUrl);
System.Net.WebResponse wrp = wr.GetResponse();
System.Xml.Linq.XDocument xd = System.Xml.Linq.XDocument.Load(wrp.GetResponseStream());
System.Xml.Linq.XElement resultXML = xd.Element("result");
String[] coordnate = new String[2];
coordnate[0] = resultXML.Attribute("x").Value.ToString();
coordnate[1] = resultXML.Attribute("y").Value.ToString();
return coordnate;
}