• 高德地图-设置点标注的文本标签


    1、问题背景

         高德地图中,设置选中位置,并自定义图标和文字提示


    2、实现源码

    <!DOCTYPE html>
    <html>
    	<head>
    		<meta charset="UTF-8">
    		<meta http-equiv="X-UA-Compatible" content="IE=edge">
        	<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
    		<title>高德地图-设置点标注的文本标签</title>
    		<link rel="stylesheet" href="http://cache.amap.com/lbs/static/main1119.css"/>
        	<script src="http://webapi.amap.com/maps?v=1.3&key=c2eb520334ddc5ab2bb70a3afe6a58cc"></script>
        	<script type="text/javascript" src="http://cache.amap.com/lbs/static/addToolbar.js"></script>
    	</head>
    	<body>
    		<div id="container"></div>
    		<script>
    			var map = new AMap.Map("container",{
    				resizeEnable: true,
            		center: [115.397428, 41.90923],
            		zoom: 19
    			});
    			
    			var marker = new AMap.Marker({
    		        position: map.getCenter()
    		    });
    		    
    		    marker.setMap(map);
    		    //设置鼠标划过点标记显示的文字提示
    		    marker.setTitle("设置位置");
    		    marker.setLabel({
    		        offset: new AMap.Pixel(15, 15),
    		        content: "定位名称"
    		    });
    		</script>
    	</body>
    </html>
    

    3、实现结果



  • 相关阅读:
    F. Maximum White Subtree 树形dp*换根
    D
    E
    两圆相交板子
    lucass定理
    高精度求组合数
    康托展开与康托逆展开
    FFT变换
    Codeforces Round #625 Div. 1 Problem C
    E.Multiply Pollard_rho质因数分解
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13314180.html
Copyright © 2020-2023  润新知