# arrow-map **Repository Path**: shi-mingmin/arrow-map ## Basic Information - **Project Name**: arrow-map - **Description**: 海图SDK使用示例 - **Primary Language**: JavaScript - **License**: Not specified - **Default Branch**: main - **Homepage**: https://shi2310.github.io/arrow-map/ - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-10-18 - **Last Updated**: 2025-04-24 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Arrow 海图 SDK 基于 Leaflet 构建的地图 SDK。  ## 接口介绍 1. 初始化 ``` const map = new MyMap("map"); ``` 2. 绘制船舶 [drawShips] ``` map.drawShips([ { mmsi: "1120154506", label: "神华506", lng: 121.705, lat: 31.3, course: 45, updatetime: "2024-5-31", width: 60, length: 110, }, ]); ``` 3. 底图叠加层 [groundOverlay] ``` map.groundOverlay( [ [31.721139190517842, 121.67430248603551], [31.732439796482474, 121.69906802998445], ], { type: "image", url: bgPng, opacity: 1, } ); ``` 4. 绘制圆圈 [drawCircle] ``` map.drawCircle([31.28, 121.75], { radius: 10, color: #ff0000, weight: 2, dashArray: "5,5", fillColor: "rgba(0,0,0,.5)", fillOpacity: 0.3, }); ``` 5. 绘制轨迹线 [drawTrajectory] ``` map.drawTrajectory([ { lat: 31.254086, lng: 121.742848, ts: "2024-7-19 15:32:41" }, { lat: 31.254086, lng: 121.743048, ts: "2024-7-19 16:00:41" }, { lat: 31.35, lng: 121.805, ts: "2024-7-20 16:32:41" }, { lat: 31.37, lng: 121.835, ts: "2024-7-21 18:32:41" }, { lat: 31.4, lng: 121.9, ts: "2024-7-22 15:32:41" }, ]) ``` 6. 播放轨迹动画 [playAnimatedMarker] ``` map.playAnimatedMarker( { points: historyLines, totalDuration: 10000, }, { iconSize: [38, 26], iconAnchor: [19, 13], iconUrl: icon, }, null, // 每帧动画渲染的回调 () => { // 动画结束 } ); ``` 7. 暂停轨迹动画 [pauseAnimatedMarker] ``` map.pauseAnimatedMarker(true); ``` 8. 绘制点标记 [drawPointMarkers] ``` map.drawPointMarkers([ { lat: 31.374086, lng: 121.732848, text: "2024-7-19 15:32:41", icon: stop1Png, }, { lat: 31.36, lng: 121.805, text: "2024-7-20 15:32:41", icon: stop2Png }, ]); ``` 9. 绘制 HTML 浮层[drawHtmlOverlay] ``` map.drawHtmlOverlay( [31.28, 121.75], `