将自家的位置标注到地图上(51ditu.com)

会一点点html语言的程序员,都可以将如下代码存为2个文件,利用第一个文件查到的经纬度数字,替换第2个文件数字,更新第2个文件中的提示信息,这样用浏览器打开第二个文件,就可以如愿在联网的时候看到自家位置标注在地图上,感谢51ditu.com

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<title>查找标注点的经纬度</title> 

<script language="javascript" src=" http://api.51ditu.com/js/maps.js "></script>

</head> 

<body>

<div id="myMap" style="position:relative; width:800px; height:600px;"></div>

<script language="javascript">

var maps = new LTMaps( "myMap" );

maps.cityNameAndZoom( "shanghai" , 5 );

maps.handleKeyboard(); //键盘操作支持

maps.handleMouseScroll();//鼠标滚轮支持

//var control = new LTStandMapControl();

var control1 = new LTSmallMapControl();

maps.addControl( control1 );

var control = new LTMarkControl();

maps.addControl( control );

function getPoi(){

var poi = control.getMarkControlPoint();

alert( "经度:" + poi.getLongitude() + " 纬度:" + poi.getLatitude()); 

}

LTEvent.addListener( control , "mouseup" , getPoi );

</script>

</body>

</html>

<html>

<head>

    <title>显示标注点</title>

    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">

    <script language="javascript" src="http://api.51ditu.com/js/maps.js "></script>

</head>

<body>    

    <div id="myMap" style="position:relative; width:800px; height:600px;"></div>

    <script language="javascript">

var maps = new LTMaps( "myMap" );

maps. centerAndZoom ( new LTPoint( 12138436,3110641 ) , 1 );//经度 , 维度

var point = new LTPoint( 12138436,3110641 );//经度 , 维度

var marker = new LTMarker( point );

maps.addOverLay( marker );

var infoWin = new LTInfoWindow( marker );

infoWin.setTitle("上海思巴得信息科技有限公司");

infoWin.setLabel( "上海市闵行区闵城路199弄(好世鹿鸣苑)10号楼1701室" ); 

maps.addOverLay( infoWin );

var control=new LTStandMapControl(1);

maps.addControl(control);//添加简易导航到地图

</script>   

</body>

</html>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值