this.map = new maptalks.Map("mapDiv", { center: [this.coordinate[0].x, this.coordinate[0].y], zoom: 8.8, minZoom: 3, maxZoom: 16, attribution: false, //隐藏log spatialReference: "EPSG:3857", baseLayer: new maptalks.TileLayer("base", { urlTemplate: "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}.jpg", }), // layers: [ // new maptalks.VectorLayer('A', [new maptalks.Marker([119.04, 37.18])]) //红色位置图标 // ] }); //图标图层添加到这张地图上 this.markerLayer = new maptalks.VectorLayer('vector').addTo(this.map); this.toolLayer = new maptalks.VectorLayer('mapvector'); // 图标以及点击事件 this.coordinate.forEach((item) => { let button = "assets/img/bigscreem/button.png"; var marker = new maptalks.Marker([item.x, item.y], { symbol: { markerFile: require(`@/${button}`), markerWidth: 40, markerHeight: 49, markerDx: 0, markerDy: 0, // markerOpacity: 0.1, markerFill: '#3EEAC6', //内部填充色 // markerLineColor: 'red', //边框颜色 'textName': item.name, 'textFill': '#fff', 'textHorizontalAlignment': 'bottom', 'textSize': 14, textDx: 10 } }) //将图标添加到图标图层 marker.addTo(this.markerLayer) marker.on('click', function () { that.tab = item.name; }) });
maptalk地图以及自定义标点的引入
最新推荐文章于 2024-11-04 10:56:52 发布