메뉴 건너뛰기

프로그램언어

조회 수 18635 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="generator" content="kimsQ">
<meta name="author" content="<?=$browse['name']?>">
<meta name="keywords" content="<?=$browse['title']?> <?=$R['tag']?>">
<title>네이버 맵</title>
</head>
<body  leftmargin=0 topmargin=0 marginwidth=0 >
<?
function getUTF_8($str)
{
return iconv('EUC-KR','UTF-8',$str);
}

function getEUC_KR($str)
{
return iconv('UTF-8','EUC-KR',$str);
}

function getnavermapXml2($navermapxml_url,&$ygeopoint_x,&$ygeopoint_y){
$pquery = $navermapxml_url;
$fp = fsockopen ("maps.naver.com", 80, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)";
} else {
fputs($fp, "GET /api/geocode.php?");
fputs($fp, $pquery);
fputs($fp, " HTTP/1.1\r\n");
fputs($fp, "Host: maps.naver.com\r\n");
fputs($fp, "Connection: Close\r\n\r\n");

$header = "";
while (!feof($fp)) {
$out = fgets ($fp,512);
if (trim($out) == "") {
break;
}
$header .= $out;
}

$mapbody = "";
while (!feof($fp)) {
$out = fgets ($fp,512);
$mapbody .= getUTF_8($out);
}

$idx = strpos(strtolower($header), "transfer-encoding: chunked");

if ($idx > -1) { // chunk data
$temp = "";
$offset = 0;
do {
$idx1 = strpos($mapbody, "\r\n", $offset);
$chunkLength = hexdec(substr($mapbody, $offset, $idx1 - $offset));

if ($chunkLength == 0) {
break;
} else {
$temp .= substr($mapbody, $idx1+2, $chunkLength);
$offset = $idx1 + $chunkLength + 4;
}
} while(true);
$mapbody = $temp;
}
fclose ($fp);
 }
// 여기까지 주소 검색 xml 파싱

$map_x_point_1=explode("<x>", ($mapbody));
$map_x_point_2=explode("</x>", $map_x_point_1[1]);
$ygeopoint_x=$map_x_point_2[0];
$map_y_point_1=explode("<y>", ($mapbody));
$map_y_point_2=explode("</y>", $map_y_point_1[1]);
$ygeopoint_y=$map_y_point_2[0];
#
}//end function
#
$naver_mapkey = "/*이자리에 발급받은 코드를 입력하세요*/";//http://dev.naver.com/openapi/register 지도키 발급코드
//$addr <== 여기에 주소를 입력하거나 값을 넘겨주면 되겠지요
$navermapxml_url='key='.$naver_mapkey.'&query='.getUTF_8($addr);
#
getnavermapXml2($navermapxml_url,$ygeopoint_x,$ygeopoint_y);
?>
<!-- 네이버 지도 키 값 -->
<script type="text/javascript" src="http://map.naver.com/js/naverMap.naver?key=<?php echo $naver_mapkey?>"></script>
<!-- 네이버 지도 키 값 끝 -->
<style>
#mapcontainer{
width: <?php echo $map_width?>px;
height: <?php echo $map_height?>px;http://naver.com/
margin:0;
}
</style>
<div id="mapbody"></div>
<div id="display"></div>
<script type="text/javascript">

 var x_point = '<? echo ($ygeopoint_x)?$ygeopoint_x:0; ?>';
 var y_point = '<? echo ($ygeopoint_y)?$ygeopoint_y:0; ?>';
 /*
 * 지도API 2.0은 기존의 카텍 좌표 외에도 위경도 좌표를 지원합니다.
 * 위경도 좌표를 사용하기 위해서는 기존의 NPoint 클래스 대신 NLatLng 클래스를 사용해야 합니다.
 *
 * http://maps.naver.com/api/geocode.php 에서 "경기도성남시정자1동25-1"을 검색한 결과인
 * x : 321033, y : 529749
 * 를 예로 들어 설명해 보겠습니다.
 *
 * 편의를 위해 전역변수로 mapObj, tm128, latlng를 선언해 두었습니다.
 */
var mapObj = new NMap(document.getElementById('mapbody'),<?php echo $map_width?>,<?php echo $map_height?>);
var tm128 = new NPoint(x_point,y_point);
var latlng;
/*
 * 경기도성남시정자1동25-1의 위치로 이동합니다. 레벨은 1로 지정하였습니다.
 * 인덱스맵과 확대/축소 컨트롤러를 등록하고 마우스 줌인/아웃을 활성화 하였습니다.
 */
mapObj.setCenterAndZoom(tm128, <?php echo $yzoom?>);
mapObj.addControl(new NZoomControl());
mapObj.enableWheelZoom();
latlng = mapObj.fromTM128ToLatLng(tm128);
/*
 * NMark도 마찬가지로 tm128 대신 위경도를 사용하여 아이콘을 표시하였습니다.
 */
var mark = new NMark(latlng, new NIcon('../image/ic_spot.png',new NSize(52,41),new NSize(14,40)));
mapObj.addOverlay(mark);
</script>
</body>
</html>

List of Articles
번호 제목 날짜 조회 수
240 태그 또는 멘션 소스 뽐아내기방법 2019.01.16 1249
239 정규 표현 / 전화번호 / 이메일 2019.01.16 1206
238 포트체크 방법 2019.01.16 1288
237 금액 단위를 만단위부터 표시하는방법 2019.01.16 1900
236 RSS json_decone 사용방법 2019.01.16 1430
235 TIME_TO_SEC 시간 포맷 2019.01.16 1381
234 파일 종류에 따른 아이콘표시하기 함수 2019.01.16 1421
233 문자 숫자 중복 데이타 값 삭제 array_unique 함수 2019.01.16 1419
232 생성된 파일생성날짜 업데이트 만들기 / filemtime 2019.01.16 1371
231 메모장소스 2019.01.08 2000
230 파일 및 데이타베이스 백업 2019.01.08 1610
229 프레임 사이트에서 새로고침(F5) 할때 초기화면으로 이동하지 않음 2019.01.08 1280
228 오늘 날짜 구하기 2019.01.08 1323
227 PHP폼 사용시 폼 양식에서 값이 사라질때 2019.01.08 1316
226 폴더에 사진올려놓고 리스트자동으로 만들기 2019.01.08 1302
225 새창열 때 HTTP_REFERER 값넘기는 꽁수 2019.01.08 1451
224 공백문자 체크 2019.01.08 1625
223 자동으로 다른 페이지로 넘어가는 함수 2019.01.08 1256
222 단어필터링 2019.01.08 1251
221 이미지 사이즈 비율로 조정하기 2019.01.08 1629
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 17 Next
/ 17

하단 정보를 입력할 수 있습니다

© k2s0o1d4e0s2i1g5n. All Rights Reserved