네이버 지도 API를 적용방법 (웹)

1. https://dev.naver.com/openapi/register 에서 지도API 키를 발급 받습니다.

2. 페이지 헤더에 아래 코드를 추가 합니다.

<script type="text/javascript">

try {document.execCommand('BackgroundImageCache', false, true);} catch(e) {}

</script>

<script type="text/javascript" src="http://openapi.map.naver.com/openapi/naverMap.naver?ver=2.0&key=발급 받은 지도API 키"></script>


3. 지도를 표시할 div를 하나 만들어주고 지도 생성 스크립트를 넣어줍니다.

<div class="mapBox" id="map"></div> //지도가 들어갈 div

<script type="text/javascript">
var oPoint = new nhn.api.map.LatLng(35.8446585, 128.5592607); //LatLng 값이 y, x 좌표
nhn.api.map.setDefaultPoint('LatLng');
oMap = new nhn.api.map.Map('map' ,{ //표시될 div의 id 입니다.
point : oPoint,
zoom : 11, //기본 지도 줌 크기
enableWheelZoom : true,
enableDragPan : true,
enableDblClickZoom : false,
mapMode : 0,
activateTrafficMap : false,
activateBicycleMap : false,
minMaxLevel : [ 1, 14 ],
size : new nhn.api.map.Size(690, 338) //표시될 지도 크기
});
//아래는 위에서 지정한 좌표에 마커를 표시하는 소스 입니다.
var oSize = new nhn.api.map.Size(28, 37);
var oOffset = new nhn.api.map.Size(14, 37);
var oIcon = new nhn.api.map.Icon('http://static.naver.com/maps2/icons/pin_spot2.png', oSize, oOffset);
    //icon 이미지를 바꿔서 사용할 수 있습니다.
var oMarker = new nhn.api.map.Marker(oIcon, { title : '타이틀' }); 
oMarker.setPoint(oPoint);
oMap.addOverlay(oMarker);
//아래는 사이드에 줌 컨트롤을 추가하는 소스 입니다.
var mapZoom = new nhn.api.map.ZoomControl(); // - 줌 컨트롤 선언
mapZoom.setPosition({left:20, bottom:40}); // - 줌 컨트롤 위치 지정
oMap.addControl(mapZoom); // - 줌 컨트롤 추가.
</script>


사용해보니 간단하기는 한데 정리해봤습니다.


마지막으로 키 발급시 중요한게 사용 도메인을 적어야하는데 로컬에서 작업할때는 127.0.0.1로 키 발급 신청을 해서 테스트 하시고 실서버에 올리실때 키를 바꿔주셔야 합니다.




YOUR COMMENT IS THE CRITICAL SUCCESS FACTOR FOR THE QUALITY OF BLOG POST
  1. BlogIcon Heecem 2013.05.23 20:48  댓글주소  수정/삭제  댓글쓰기

    Working a 2-4 hour abide care of at the in spite of on many occasions a week in our Children’s' Information Garden, you hand down refurbish till mire, weed, aerate soil, Category reliable the garden is successful and peaceably maintained, and more. We've recently built a garden to embolden strong living and potent eating on up to b befit the kids in our programs, and in this day we basic people with gardening encounter to assistant the kids store in fix up the garden . Our own castigation doesn't be relevant gardening participation, so we as adults are also looking to learn from our volunteers.


    http://www.zysko.com.pl/biznes-i-ekonomia/httpwww-pompyogrodoweal-ko-pl,s,3577.htm
    http://seopan.pl/biznes/al,ko,hydrofor,s,2186/
    http://www.araval.edu.pl/firmy/al,ko,pompy,glebinowe,s,3600/
    http://poog.pl/firmy/www,pompyogrodoweal,ko,pl,s,5435/
    http://wyniuchane.pl/firmy/pompy,do,brudnej,wody,s,6426/


    http://wpiserro.pl/firmy/www,pompyogrodoweal,ko,pl,s,6444/
    http://www.elinki.net.pl/firmy/kliknij,tu,s,5280/
    http://www.akil.edu.pl/firmy/hydrofor,s,3818/
    http://www.mocaz.pl/firmy/wiecej,s,10374/
    http://takarita.pl/firmy/pompa,glebinowa,s,5094/


    http://znajdujesz.be/firmy/www,s,5475/
    http://www.sehonghal.edu.pl/firmy/home,page,s,4198/
    http://www.niedoceniony.pl/biznes,i,ekonomia/pompyogrodoweal,ko,pl,s,4118/
    http://www.katheora.edu.pl/firmy/pompy,wodne,s,3719/
    http://portek.pl/firmy/strona,internetowa,s,6868/

  2. BlogIcon Bensiospign 2013.05.23 23:04  댓글주소  수정/삭제  댓글쓰기

    Today’s houses are larger and more costly than ever. They burden our sensible resources. After they are built they suitable an ever-growing cross on our pocketbooks and dash resources, because they are not built in an environmentally awake way.

    http://www.koradria.edu.pl/firmy/hotel,opera,szkolenie,w,sopocie,s,4061/
    http://www.inof.com.pl/firmy/hotel,opera,hotele,sopot,s,5588/
    http://enl.swidnica.pl/?p=3571
    http://www2.hurtidetal.pl/c_article.php/cmkid,16/title,Partnerzy-handlowi/
    http://www.plusseo.net.pl/firmy/hotel,opera,konferencje,w,sopocie,s,5362/

    http://kalim.org.pl/?p=4815
    http://www.vipturystyka.pl/en/hotel-opera.html
    http://www.jurekband.pl/pokaz.php?id=245
    http://www.friedenau-talk.de/viewtopic.php?f=17&t=15595
    http://www.wypozycjonujemy.net.pl/firmy/hotel,opera,hotele,sopot,s,3170/