我有一个使用传单的html页面,我通过a.gpx文件导入数据。我想知道是否有可能修改城市的标记,即<wpt>标记,使其具有图标。这就是我目前的情况:

编辑:@ghybs
如何读取.gpx文件并从中创建传单层?
var map = L.map('map');
L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: 'Map data © <a href="http://www.osm.org">OpenStreetMap</a>'
}).addTo(map);
var gpx = 'http://127.0.0.1:5500/resultat.gpx';
new L.GPX(gpxFile, {
async: true,
marker_options: {
wptIconUrls: {
'': '/Leaflet/marker-icon.png',
},
startIconUrl: '/Leaflet/start.png',
endIconUrl: '/Leaflet/start.png',
shadowUrl: '/Leaflet/pin-shadow.png'
}
}).on('loaded', function (e) {
let gpx = e.target;
map.fitBounds(gpx.getBounds());
}).addTo(map);我编辑了代码和图片,图标是可见的,但开始/结束图标在路标下。我没有找到如何只拥有start.png。
发布于 2021-06-13 12:14:18
只需使用wptIconUrls: false和路标图标将不会显示和重叠。
https://stackoverflow.com/questions/61389223
复制相似问题