如何用PHP调用google 地图 api ?并且将数据库里经纬度表示的点显示在map上?
怎么用PHP调用google map api ?并且将数据库里经纬度表示的点显示在地图上??
如题。最好写详细点,谢谢!
------解决方案--------------------
当中 23.1150614,113.4082905 为位置的经纬度。
这个key 要到谷歌上申请
key=ABQIAAAAHDyarwhqc8qoi6Hi4Fw2ABS7hG4ulivpH-Zy5ZAv91XflKVwfhRT3BrS_8CE9kMWp7UXsEngXSYF3A
本地测试不用key
------解决方案--------------------
读数据库 需要懂动态语言基础
------解决方案--------------------
其实最好的办法是从数据库里读出数据,写入一个外部的KML文件里,再用JS载入。
这东西不是三言两语说的清的,代码什么的,最好自己研究,关键是要真正理解。
参考 https://developers.google.com/maps/documentation/javascript/layers
------解决方案--------------------
demo: http://gmaps-samples.googlecode.com/svn/trunk/ggeoxml/ggeoxml_loader.html
kml: http://kml.lover.googlepages.com/my-vacation-photos.kml
源码自己研究去吧。
如题。最好写详细点,谢谢!
------解决方案--------------------
当中 23.1150614,113.4082905 为位置的经纬度。
<!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>
<meta http-equiv="X-UA-Compatible" content="IE=7" />
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta name="description" content=" " />
<title>谷歌地图 api测试</title>
<style>
.map {
width: 205px;
height: 192px;
text-align: center;
margin: 0 auto;
}
</style>
</head>
<body>
<div id="res_map" class="map"></div>
<script src="http://ditu.google.cn/maps?file=api&v=2&&key=ABQIAAAAHDyarwhqc8qoi6Hi4Fw2ABS7hG4ulivpH-Zy5ZAv91XflKVwfhRT3BrS_8CE9kMWp7UXsEngXSYF3A" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
function show_small_map()
{
if (GBrowserIsCompatible())
{
var map = new GMap2(document.getElementById("res_map"));
function createMarker(latlng)
{
var marker = new GMarker(latlng);
return marker;
}
map.setCenter(new GLatLng(23.1150614,113.4082905), 16);
var smc = new GSmallZoomControl3D;
map.addControl(smc);
var latlng = new GLatLng(23.1150614,113.4082905);
map.addOverlay(createMarker(latlng));
}
}
show_small_map();
</script>
</body>
</html>
这个key 要到谷歌上申请
key=ABQIAAAAHDyarwhqc8qoi6Hi4Fw2ABS7hG4ulivpH-Zy5ZAv91XflKVwfhRT3BrS_8CE9kMWp7UXsEngXSYF3A
本地测试不用key
------解决方案--------------------
读数据库 需要懂动态语言基础
------解决方案--------------------
其实最好的办法是从数据库里读出数据,写入一个外部的KML文件里,再用JS载入。
这东西不是三言两语说的清的,代码什么的,最好自己研究,关键是要真正理解。
参考 https://developers.google.com/maps/documentation/javascript/layers
------解决方案--------------------
demo: http://gmaps-samples.googlecode.com/svn/trunk/ggeoxml/ggeoxml_loader.html
kml: http://kml.lover.googlepages.com/my-vacation-photos.kml
源码自己研究去吧。