메뉴 건너뛰기

프로그램언어

조회 수 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>

  1. 함수이름을 변수로 사용하기, 매개변수 없는 함수에 매개변수 넣기

    Date2021.03.26 Views746
    Read More
  2. JAVASCRIPT 차트, 그래프 모음 (php chart, graph )

    Date2021.03.26 Views1612
    Read More
  3. 구글 학술 검색

    Date2021.03.26 Views255
    Read More
  4. 복권 번호 뽑기

    Date2021.03.26 Views338
    Read More
  5. 문자열 함수 모음

    Date2021.03.26 Views318
    Read More
  6. 알파벳 순서대로 출력하기 ord(), chr()

    Date2021.03.26 Views578
    Read More
  7. MYSQL DB의 모든 테이블에서 문자열 검색 하기

    Date2021.03.26 Views913
    Read More
  8. while, for, foreach 속도 비교

    Date2021.03.26 Views618
    Read More
  9. 배열 더하기 (+ 를 이용한 배열 합치기 )

    Date2021.03.26 Views451
    Read More
  10. csv파일 다루기. fputcsv(), fgetcsv()

    Date2021.03.26 Views558
    Read More
  11. substr(), mb_substr(), iconv_substr()

    Date2021.03.26 Views564
    Read More
  12. PEAR DB 관련 함수들

    Date2021.03.26 Views690
    Read More
  13. 파일을 변수에 담기(ob_start를 이용한 방법)

    Date2021.03.26 Views674
    Read More
  14. 문자,숫자 랜덤 출력

    Date2021.03.26 Views404
    Read More
  15. PHP Notice: Use of undefined constant ... assumed ... 오류

    Date2021.03.26 Views307
    Read More
  16. HTTP 인증하기, 로그인창 띄우기

    Date2021.03.26 Views214
    Read More
  17. 콜론 연산자

    Date2021.03.26 Views307
    Read More
  18. 상수, 마법상수, 모든 상수 보기

    Date2021.03.26 Views236
    Read More
  19. 조건문의 함수실행 여부 if ( 0 && ... )

    Date2021.03.26 Views227
    Read More
  20. printf() sprintf()

    Date2021.03.26 Views272
    Read More
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 17 Next
/ 17

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

© k2s0o1d4e0s2i1g5n. All Rights Reserved