|
|
|
อยากได้โค๊ดในส่วนของการค้นหาข้อมูลแผนที่ Google Map api ค่ะ รบกวนหน่อยนะคะ |
|
|
|
|
|
|
|
อยากได้โค๊ดในส่วนของการค้นหาข้อมูลแผนที่ Google Map api พอดีตอนนี้ทำแผนที่ไว้แล้วแต่ยังค้นหาข้อมูลไม่ได้ รบกวนด้วยค่ะ
อันนี้เป็น Script ของโค๊ดนะคะ
Code (PHP)
<?php
include "../config.php";
include "../images_system.php";
$result_data=get_a_line("select * from contact ");
$result_data['map_latigude'] = $result_data['map_latigude'] == '' ? '18.77785996322457' : $result_data['map_latigude'];
$result_data['map_lantigude'] = $result_data['map_lantigude'] == '' ? '98.98394107818604' : $result_data['map_lantigude'];
$result_data['map_info_latigude'] = $result_data['info_latigude'] == '' ? '18.77785996322457' : $result_data['info_latigude'];
$result_data['map_info_lantigude'] = $result_data['info_lantigude'] == '' ? '98.98394107818604' : $result_data['info_lantigude'];
$result_data['map_zoom'] = (int)$result_data['map_zoom'] == 0 ? 7 : $result_data['map_zoom'];
$result_data['map_width'] = (int)$result_data['map_width'] == 0 ? 600 : $result_data['map_width'];
$result_data['map_height'] = (int)$result_data['map_height'] == 0 ? 400 : $result_data['map_height'];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<title>Google Map</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<style type="text/css">html,body,#map_canvas{height:100%}body{margin:0 auto;padding:0}</style>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
var map;
var marker;
function initialize() {
geocoder = new google.maps.Geocoder();
var myLatlng=new google.maps.LatLng(<?=$result_data['map_latigude']?>,<?=$result_data['map_lantigude']?>);// กำหนดจุดเริ่มต้นของแผนที่
var myOptions={zoom:<?=$result_data['map_zoom']?>,center:myLatlng,mapTypeId:google.maps.MapTypeId.ROADMAP};
map=new google.maps.Map(document.getElementById("map_canvas"),myOptions);
google.maps.event.addListener(map,"zoom_changed",function(){var p=marker.getPosition();map.panTo(p);mapChanged();});
google.maps.event.addListener(map,"dragend",function(){mapChanged();});
var info=new google.maps.LatLng(<?=$result_data['map_info_latigude']?>,<?=$result_data['map_info_lantigude']?>);
marker=new google.maps.Marker({position:info,map:map,draggable:true,title:'ลากหมุดนี้ไปยังตำแหน่งที่ตั้งของร้าน!'});
google.maps.event.addListener(marker,"dragend",function(){var p=marker.getPosition();map.panTo(p);mapChanged();});mapChanged();};
function mapChanged(){
var p=marker.getPosition();
top.document.getElementById("info_latigude").value=p.lat();
top.document.getElementById("info_lantigude").value=p.lng();
var c=map.getCenter();
top.document.getElementById("map_latigude").value=c.lat();
top.document.getElementById("map_lantigude").value=c.lng();
top.document.getElementById("map_zoom").value=map.getZoom();
};
</script></head>
<body onload="initialize()"><div id="map_canvas"></div></body></html>
Tag : PHP, MySQL
|
|
|
|
|
|
Date :
2013-08-06 12:12:58 |
By :
bobo_lucksana |
View :
1572 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
http://www.ninenik.com/forum_view_1008_1.html
http://www.ninenik.com/content.php?arti_id=327
ลองศึกษาดูคับ
|
|
|
|
|
Date :
2013-08-06 18:02:17 |
By :
โอ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 02
|