QQ地图webservice使用方法

来源:互联网 发布:java 转int 编辑:程序博客网 时间:2024/06/07 17:21
腾讯地图WebService API : http://lbs.qq.com/webservice_v1/guide.html ;

<%@ 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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>简单地图</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<style type="text/css">
html,body{
    width:100%;
    height:100%;
}
*{
    margin:0px;
    padding:0px;
}
body, button, input, select, textarea {
    font: 12px/16px Verdana, Helvetica, Arial, sans-serif;
}
p{
    width:603px;
    padding-top:3px;
    overflow:hidden;
}
.btn{
    width:142px;
}
#container{
    min-width:600px;
    min-height:767px;
}
</style>
<script charset="utf-8" src="http://map.qq.com/api/js?v=2.exp"></script>
<script>

window.onload = function(){

//直接加载地图

/* 
    1,腾讯地图开发密匙KEY(测试用途) : RZQBZ-OZ5RR-VAGWQ-W7G6E-DGA3Z-RFBT2
   
    2,Get请求,注意参数值要进行URL编码(推荐encodeURI)    
   
    3,webservice服务示例:
    http://apis.map.qq.com/ws/place/v1/search?
    keyword=%E9%85%92%E5%BA%97&
    boundary=nearby(39.908491,116.374328,1000)&
    key=RZQBZ-OZ5RR-VAGWQ-W7G6E-DGA3Z-RFBT2
     */
     
    
    //初始化地图函数  自定义函数名init
    function init() {
        //定义map变量 调用 qq.maps.Map() 构造函数   获取地图显示容器
         var map = new qq.maps.Map(document.getElementById("container"), {
            center: new qq.maps.LatLng(39.9108,116.3725),      // 地图的中心地理坐标。
            zoom:8                                                 // 地图的中心地理坐标。
        });
    }
    

    //调用初始化函数地图
    init();


}
</script>
</head>
<body>
<!--   定义地图显示容器   -->
<div id="container"></div>
</body>
</html>

0 0
原创粉丝点击