我使用传单 0.7.7 创建了一张地图,并使用 geojson 数据添加了一些标记和图层。我想在每个标记中添加一个链接以打开 OSRM 页面,起点以所选标记为中心。在我的 data_marker_layer.js 我有这样的结构
{
"type": "Feature",
"properties": {
"marker-color": "#0000ff",
"marker-size": "medium",
"marker-symbol": "water",
"name": "Fontana Valle",
"address": "Via della Valle 19 - VALLE LOMELLINA",
"description": '<div style="width: 240px; text-align:justify;">Fontanella con acqua potabile, si trova difronte alla Piazza Corte Granda. </div><p text-align="center";><a href="http://www.mappeattive.com/wp-content/uploads/2015/11/fontanavallelomellina.jpg"><img data-id="2021" src="http://www.mappeattive.com/wp-content/uploads/2015/11/fontanavallelomellina.jpg" alt="Fontanella Acqua Potabile" width="240" height="140" class="alignnone size-medium wp-image-2021" /></a></p>'
},
"geometry": {
"type": "Point",
"coordinates": [
8.664894998073578,
45.150788440748805
]
}
}
标记弹出窗口的代码图是:
function interaction(feature, layer){
layer.on({
click: function click (e){var popupContent = "<strong>" +
feature.properties.name + "</strong><br />"+feature.properties.address +"<br />";
if (feature.properties.description) {
popupContent += feature.properties.description+'GPS: '+feature.geometry.coordinates;
}
layer.bindPopup(popupContent,{maxWidth: 320});
}
})
}
如何编写一些代码来添加“获取路线”链接并使用标记坐标打开 OSRM 路由器或 Googlemap?我不是开发人员,所以我不知道是否可以使用 this.feature.geometry.coordinates
任何提示或我可以在哪里寻找解释?