³ª¸¸ÀÇ ³×À̹ö Áöµµ ¸¸µé±â, Áöµµ API ¸Å½¬¾÷(Mashup) |
|
|
 |
14³â Àü |
³×À̹ö Áöµµ API ¸¦ È°¿ëÇؼ Áöµµ¸¦ ¸¸µå´Â ºñ±³Àû °£´ÜÇÑ »ùÇÃÀÔ´Ï´Ù. ¾Æ·¡ ¼Ò°³µÈ ¼Ò½º Äڵ带 ½ÇÇàÇϸé 100°³ÀÇ ¸¶Ä¿°¡ »Ñ·ÁÁö°í ÇØ´ç ¸¶Ä¿¸¦ Ŭ¸¯Çϸé À̹ÌÁö¸¦ º¸¿©ÁÖ´Â ´ÙÀ½°ú °°Àº ½ÇÇà ȸéÀ» È®ÀÎÇÒ ¼ö ÀÖ½À´Ï´Ù. ÀÚ½ÅÀÇ È¨ÆäÀÌÁö¿¡¼ Å×½ºÆ® Çϱâ À§Çؼ´Â ³×À̹ö Áöµµ API Å°¸¦ ÇØ´ç ȨÆäÀÌÁö (http://dev.naver.com/openapi/register) ¿¡¼ ¾òÀ» ¼ö ÀÖÀ¸¸ç Å° °ª($naver_map_api_key)À» ¾òÀº API Å°·Î ±³Ã¼ÇØ¾ß ÇÕ´Ï´Ù. Âü°í·Î ±¸±Û Áöµµ API¿¡µµ °ü½ÉÀÌ ÀÖ´Â ºÐÀº ¾Õ¼ ¼Ò°³ÇÑ "ÀÚ¹Ù½ºÅ©¸³Æ®·Î Áöµµ ¸¸µé±â, ±¸±Û Áöµµ API ¸Å½Ã¾÷(Mashup)" Æ÷½ºÆ®µµ Âü°íÇϼ¼¿ä.
[½ÇÇà ȸé] http://www.hompydesign.com/map/naver.html
[¼Ò½º ÄÚµå]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title><?=$hompy_title?></title>
<script type="text/javascript" src="/js/jquery.js"></script>
<script type="text/javascript" src="http://map.naver.com/js/naverMap.naver?key=<?=$naver_map_api_key?>"></script>
<style type="text/css">
#map_box {position:relative;}
#map_canvas { width: 578px; height: 460px; margin: 0; padding: 0; border: 0; }
#map_box {width:578px; border: 4px solid #cccccc; padding:2px;}
#display_loading_box {width:578px; height:460px; position:absolute; background-color:#000000; z-index:1000; opacity: 0.5; filter: alpha(opacity = 50);}
#display_loading_box_icon {margin: 214px 273px; width:32px; height:32px;}
body,td,tr { font-size:12px; font-family:µ¸¿ò,verdana,arial,sans serif;}
.window_image {border:1px solid #cccccc; width:140px; height:100px;}
</style>
<script type="text/javascript">
var map;
var tm128 = new NPoint(315741,544301);
var latlng;
var person_list;
var infowin;
$(document).ready(function(){
display_loading();
map = new NMap($('#map_canvas')[0],578,460);
map.setCenterAndZoom(tm128, 4);
//map.addControl(new NIndexMap());
map.addControl(new NZoomControl());
map.addControl(new NMapBtns());
map.enableWheelZoom();
for (record in person_list) {
display_marker(person_list[record]);
}
display_marker({user:0,lon:127.046,lat:37.5066});
map.setCenter(latlng);
NEvent.addListener(map,"click",function (latlng){
if (infowin) map.removeOverlay(infowin);
});
NEvent.addListener(map,"startDrag",function (latlng){
if (infowin) map.removeOverlay(infowin);
});
setTimeout(display_loaded, 1000);
});
function transFromTM128ToLatLng() {
latlng = map.fromTM128ToLatLng(tm128);
document.getElementById("display").innerHTML = latlng;
}
function moveLatLng() {
map.setCenter(latlng);
}
function display_marker(record) {
latlng = new NLatLng(record.lat, record.lon);
var marker = new NMark(latlng, new NIcon('http://static.naver.com/maps/ic_spot.png',new NSize(52,41),new NSize(14,40)));
var html = '<a href="http://hompy.info/580"><img src="/hompydesign.com?seq='+record.user+'" class="window_image"></a>';
map.addOverlay(marker);
NEvent.addListener(marker,"click",function (latlng){
if (infowin) map.removeOverlay(infowin);
infowin = new NInfoWindow();
map.addOverlay(infowin);
infowin.set(latlng, "<TABLE style='width:100px;height:50px;background-color:#FFFFFF; border:solid 1px #666666'><TR><TD>"+html+"</TD></TR></TABLE>");
infowin.showWindow();
//NEvent.addListener(infowin,"mouseout",function () {infowin.hideWindow();});
});
}
function display_loading(){
var html = "<div id='display_loading_box'><img src='images/loading.gif' id='display_loading_box_icon' /></div>";
$('#map_canvas').before(html);
}
function display_loaded(){
$('#display_loading_box').remove();
}
person_list =
[{user:1,lon:127.034,lat:37.5059},{user:2,lon:127.029,lat:37.5125},{user:3,lon:127.032,lat:37.5306},{user:4,lon:127.034,lat:37.4994},{user:5,lon:127.036,lat:37.5169}];
</script>
</head>
<body>
<div id="map_box">
<div class="map" id="map_canvas"></div>
</div>
</body>
</html> |
|
̵̧ : 367 |
̵̧
¸ñ·Ï
|
|