不错呦!smile@林凯西,确保“准备文件”中的几个文件都有安装,S...您好,看了您这篇帖子觉得很有帮助。但是有个问题想请...我的修改过了怎么还被恶意注册呢 @jjjjiiii 用PJ快9年了,主要是A...PJ3啊,貌似很少有人用PJ了,现在不是WP就是z...@332347365,我当时接入时错误码没有-10...楼主,ChkValue值应为-103是什么意思呢?...大哥 你最近能看到我发的信息,请跟我联系,我有个制...
百度地图API:Google/GPS坐标转为百度坐标工具
编辑:dnawo 日期:2012-02-22
复制内容到剪贴板
程序代码

<!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="Content-Type" content="text/html; charset=gb2312" />
<title>Google/GPS坐标转为百度坐标工具-Mzwu.COM</title>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=1.2"></script>
<script type="text/javascript" src="http://dev.baidu.com/wiki/static/map/API/examples/script/convertor.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
var map = new BMap.Map("container", {mapType:BMAP_HYBRID_MAP});
map.addControl(new BMap.NavigationControl());
map.addControl(new BMap.MapTypeControl());
//坐标转换回调函数
translateCallback = function(point){
$("#txtLng2").val(point.lng);
$("#txtLat2").val(point.lat);
map.clearOverlays();
var marker = new BMap.Marker(point);
map.addOverlay(marker);
map.centerAndZoom(point, 18);
}
//坐标转换
$("#btnTranslate").click(function(){
var lng = $("#txtLng1").val();
var lat = $("#txtLat1").val();
var type = $("#txtType").val();
var point = new BMap.Point(lng, lat);
BMap.Convertor.translate(point,type,translateCallback);
});
});
</script>
</head>
<body>
经度:<input type="text" name="txtLng1" id="txtLng1" />
<br />
纬度:<input type="text" name="txtLat1" id="txtLat1" />
<br />
类型:
<select name="txtType" id="txtType">
<option value="0">GPS坐标</option>
<option value="2">Google坐标</option>
</select>
<br />
<br />
<input type="button" name="btnTranslate" id="btnTranslate" value="开始转换" />
<br />
<br />
经度:<input type="text" name="txtLng2" id="txtLng2" />
<br />
纬度:<input type="text" name="txtLat2" id="txtLat2" />
<br />
<br />
<div style="width:520px;height:340px;border:1px solid gray" id="container"></div>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Google/GPS坐标转为百度坐标工具-Mzwu.COM</title>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=1.2"></script>
<script type="text/javascript" src="http://dev.baidu.com/wiki/static/map/API/examples/script/convertor.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
var map = new BMap.Map("container", {mapType:BMAP_HYBRID_MAP});
map.addControl(new BMap.NavigationControl());
map.addControl(new BMap.MapTypeControl());
//坐标转换回调函数
translateCallback = function(point){
$("#txtLng2").val(point.lng);
$("#txtLat2").val(point.lat);
map.clearOverlays();
var marker = new BMap.Marker(point);
map.addOverlay(marker);
map.centerAndZoom(point, 18);
}
//坐标转换
$("#btnTranslate").click(function(){
var lng = $("#txtLng1").val();
var lat = $("#txtLat1").val();
var type = $("#txtType").val();
var point = new BMap.Point(lng, lat);
BMap.Convertor.translate(point,type,translateCallback);
});
});
</script>
</head>
<body>
经度:<input type="text" name="txtLng1" id="txtLng1" />
<br />
纬度:<input type="text" name="txtLat1" id="txtLat1" />
<br />
类型:
<select name="txtType" id="txtType">
<option value="0">GPS坐标</option>
<option value="2">Google坐标</option>
</select>
<br />
<br />
<input type="button" name="btnTranslate" id="btnTranslate" value="开始转换" />
<br />
<br />
经度:<input type="text" name="txtLng2" id="txtLng2" />
<br />
纬度:<input type="text" name="txtLat2" id="txtLat2" />
<br />
<br />
<div style="width:520px;height:340px;border:1px solid gray" id="container"></div>
</body>
</html>
参考资料
[1].百度坐标为何有偏移:http://openapi.baidu.com/map/faq.html#l8
[2].坐标转换:http://openapi.baidu.com/map/examples.html?v=1.2&0_5#0&5
评论: 0 | 引用: 0 | 查看次数: 6798
发表评论
请登录后再发表评论!