<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>HSMAP</title> <link rel="shortcut icon" type="image/x-icon" href="./images/icon.png"> <link rel="stylesheet" href="./css/leaflet.css"> <link rel="stylesheet" href="./icon/fontStyle.css"> <link rel="stylesheet" href="./css/baseMap.css"> <style> html, body, #mapDiv { margin: 0; padding: 0; width: 100%; height: 100%; z-index: 9; } </style> <script src="./js/leaflet/leaflet.js"></script> <!-- 定义坐标系的插件--> <script src="./js/leaflet_plugins/proj4-compressed.js"></script> <script src="./js/leaflet_plugins/proj4leaflet.js"></script> <!-- jquery --> <script src="./js/jquery/jquery-2.1.1.min.js"></script> <script src="./js/turf.min.js"></script> </head> <body> <div id="mapDiv"></div> <script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.15&key=67cb0ff5e85fe2c7558e1984e681882e"> </script> <script src="map.js"></script> <script> var hsmap = new HSMap({ mapBaseUrl: location.protocol + "//" + location.hostname + ":" + location.port + "/flh-map", appKey: "app", container: "mapDiv", userId: "app", //用户id equipment: 'mobile', //设备类型 pc/mobile roleType: '1', //mobile设备下必穿,0:非农户,展示红色地块,1:农户端,不展示红色地块 options: { // command: "goToXY", // 坐标定位(行政区划坐标) // params: { // x: 31.187586, // y: 121.43655, // zoom: 16 // } // command: "locatorLand", // 一或多个地块定位 // params: { landCodes: ["3304111042003000002"], enableRender: true } }, authRes: { //districtCodes: ["330411103"] //行政区编码数组,与 landCodes、userId 三选一;注:districtCodes:["*"]时,显示所有地块资源 //districtCodes: ["*"] //landCodes:["3304111042003000002"] //地块编号数组, 如果 landCodes 数组传入值时按地块编号控制地块资源权限;否则按 userId 来控制地块资源权限。 }, onReady: onReadyMap, onError: onErrorMap, registerListener: { onMapClickQueryCallback: (evt) => { console.log("=======onMapClickQueryCallback=========="); console.log(evt); } } }); function onReadyMap(evt) { } function onErrorMap(evt) { } </script> </body> </html>