새소식

mobile/🦖 Android

[다음 맵, html] 좌표를 주소로 바꾸는 방법

  • -
728x90

[다음 맵, html] 좌표를 주소로 바꾸는 방법


특이사항 : 크로스 도메인을 해결하기 위하여, AJAX JSOP방법을 사용하였습니다.


실행결과는 아래 사진과 같습니다.



<!DOCTYPE html>

<html>

<head>

    <meta charset="utf-8">

    <title>좌표로 주소를 얻어내기</title>

    <style>

    .map_wrap {position:relative;width:100%;height:350px;}

    .title {font-weight:bold;display:block;}

    .hAddr {position:absolute;left:10px;top:10px;border-radius: 2px;background:#fff;background:rgba(255,255,255,0.8);z-index:1;padding:5px;}

    #centerAddr {display:block;margin-top:2px;font-weight: normal;}

    .bAddr {padding:5px;text-overflow: ellipsis;overflow: hidden;white-space: nowrap;}

</style>

<script type="text/javascript" src="./jquery-2.1.0.min.js"></script>

</head>

<body>

<script>

onDeviceReady();

function onDeviceReady(){

alert(1);

$.ajax({

type: "post",

contentType:"application/json",

dataType :'jsonp',

crossDomain:true,

url: "https://apis.daum.net/local/geo/coord2addr?apikey={발급받으신 API 넣어주세요}&longitude=127.10863694633468&latitude=37.40209529907863&inputCoordSystem=WGS84&output=json",

//data: params,

error   : function (msg) {

alert(msg);

},

success: function(data){

alert(data.fullName);

}

});

}

</script>

</body>

</html>


감사합니다. 질문사항이 있으시다면 댓글 남겨주세요 ^  ^

반응형
Contents

포스팅 주소를 복사했습니다

이 글이 도움이 되었다면 공감 부탁드립니다.