您的位置:首页 > 其它

调用后台获取手机客户端提交的经纬度进行定位

2012-09-13 09:20 483 查看
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>当前所在位置</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<link rel="stylesheet" type="text/css" href="css/main.css">
	<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
  <script charset="utf-8" src="http://api.map.soso.com/v1.0/main.js"></script>
<script language="javascript"> 
 
	

	 function init() {
	 var x,y;
	 	 $.get("fastweb.do?m=querylastgps",function(data){
	
		 //   $('#result').text(data);//直接展示JSON数据
	    
	 	   var j = eval("("+data+")");
	    	x=j.gps.x;
	    	y=j.gps.y;
		   $('#address').text(j.gps.address);
		   
		    
		    
		 var center = new soso.maps.LatLng(x,y);

	
		var map = new soso.maps.Map(
		    document.getElementById("container"),
		    {
		        center: center,
		        zoomLevel: 14
		    }
		);
		var marker = new soso.maps.Marker({
		    position: center,
		    map: map
		});
		var decor = new soso.maps.MarkerDecoration({
	        content: 'P',
	        margin: new soso.maps.Size(0, -4),
	        align: soso.maps.ALIGN.CENTER,
	        marker: marker
	    });
	    
		   
		  }); 
		
	
	  
	}
	
	
</script>
</head>
<body onload="init()">
当前所在位置:<div id="address" ></div>
<div id="container" style="width:800px; height:600px"></div>

<div id="centerInfo" ></div>
<div id="zoomLevelInfo" ></div>
</body>
 
</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐