你的位置:LAMP之窗 >> 资讯 >> DEMO >> 详细内容 在线投稿

根据IP地址显示地图demo

热度50票  浏览48次 【共0条评论】【我要评论 时间:2010年4月01日 11:12
本文是演示根据IP地址自动加载地图位置的demo。具体思路为:

1,利用GeoLiteCity取得当前位置的经纬度

具体参见php 利用Google Weather Api读取天气预报

2,使用经纬度坐标初始化地图,本文以mapbar为例

<script type="text/javascript" src="http://union.mapbar.com/apis/maps/free?f=mapi&v=31.2&k=yourdomainkey"></script>
<script type="text/javascript">
var maplet = null;
function initMap(){
        maplet = new Maplet("mapbar");
        maplet.centerAndZoom(new MPoint(<?=$longitude?>,<?=$latitude?>), 8);
        maplet.addControl(new MStandardControl());

</script>
</head>
<body onload="initMap()">
<div id="mapbar" style="width:800px;height:600px"></div>
</body>

TAG: demo 地图 地址
顶:4 踩:3
对本文中的事件或人物打分:
当前平均分:-1.33 (15次打分)
对本篇资讯内容的质量打分:
当前平均分:0.29 (14次打分)
【已经有14人表态】
上一篇 下一篇
发表评论

网友评论仅供网友表达个人看法,并不表明本网同意其观点或证实其描述。

查看全部回复【已有0位网友发表了看法】
       

网络资源