高德地图Demo

本文详细介绍了高德地图的多个示例Demo,包括加载插件、地图兴趣点搜索、Autocomplete与PlaceSearch的结合使用、附近搜索功能及自定义标记和2D到3D视图切换等应用场景,旨在帮助开发者更好地理解和运用高德地图API。
摘要由CSDN通过智能技术生成
  • 高德地图Demo1
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Demo3</title>
    <script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.15&key=0bcfd2ed49ad1e3bb13961bacb6a7ca8"></script> 
    <style>
        *{
    
            margin: 0;
            padding: 0;
            list-style: none;
        }
        #container{
    
                width:100%;
                height:100%;
                position: absolute;
                left: 0;
                right: 0;
            }
        .control{
    
                width: 320px;
                height: 300px;
                background-color: #fff;
                z-index:99;
                position:fixed;
                left: 40px;
                top: 40px;
                /* text-align: center; */
                padding: 10px;

        }
        .control .title{
    
            width:100%;
            text-align: center;
            font-size: 25px;
            color:#000;
            font-weight:bold;
        }
        .control div{
    
            width:100%;
            margin-top: 10px;
            height: 30px;
        }
        .control span{
    
            display: inline-block;
            width: 100px;
            text-align: right;
        }
        .control input{
    
            width: 100px;
            margin-left: 10px;
        }
        .control button{
    
            width: 50px;
            height: 30px;
            border: none;
            border-radius:5px;
            margin-left: 10px;
            background-color: lightblue;
        }
        #limitbtn{
    
            width: 100px;
            height: 30px;
            background-color: #f5f2fa;
        }
        .control .location #locationvalue{
    
            width: 40px;
        }
        
        .control .location{
    
            font-size: 10px;
            width: 180px;
            position: absolute;
            bottom:5px;
            right: 5px;
        }
    </style>
    
</head>
<body>
    <div class="control"> 
        <div class="title">工具栏</div>
        <div class="cityNode"><span>搜索城市</span><input type="text" id="cityValue"><button id="citybtn">确定</button></div>
        <div class="zoomNode"><span>设置显示级别</span><input type="text" id="zoomValue"><button id="zoombtn">确定</button></div>
        <div class="button"><span>&nbsp;</span><button id="limitbtn">解除限制范围</button></div>
        <div class="location">当前所在省/直辖市:<span id="locationvalue"></span></div>
    </div>
    <div id="container">

    </div>
    <script>
            

            //创建地图应用
            var map = new AMap.Map("container");
            //设置地图显示范围
            var myBounds = new AMap.Bounds([116.22422,39.813285],[116.567542,39.997639]);
            //解除布尔值
            var limitbln = true;
            map.setBounds(myBounds);
            map.setLimitBounds(myBounds);
            map.getCity(function(info){
    
                locationvalue.innerHTML = info.province;
            });

        //点击时获取输入的城市 ,通过setCity()方法设置地图显示在此城市
        citybtn.onclick = function(){
    
            if(cityValue.value == ""){
    
                return;
            }
            map.setCity(cityVal
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值