我想使用esri leaflet cart添加一个标记,
我使用mapbox添加标记的代码如下:
var marker = L.marker(new L.LatLng(lat, long), {
icon: L.mapbox.marker.icon({
'marker-color': 'ff8888'
}),
draggable: true
});
marker.bindPopup('adresse');
marker.addTo(map);我想通过使用esri leaflet来使用相同的东西。
请帮个忙
发布于 2020-11-03 13:11:36
您可以参考以下代码,使用ESRI leaflet API绘制一个点。
var map = L.map('map').setView([37.837, -122.479], 8);
L.esri.basemapLayer('Streets').addTo(map);
var icon = L.icon({
iconUrl: 'https://esri.github.io/esri-leaflet/img/earthquake-icon.png',
iconSize: [27, 31],
iconAnchor: [13.5, 17.5],
popupAnchor: [0, -11]
});
L.esri.featureLayer({
url: 'https://sampleserver6.arcgisonline.com/arcgis/rest/services/Earthquakes_Since1970/MapServer/0',
pointToLayer: function (geojson, latlng) {
return L.marker(latlng, {
icon: icon
});
}
}).addTo(map);发布于 2017-08-24 06:05:02
您可以在以下位置找到使用L.icon设置点要素样式的实时esri-leaflet示例:http://esri.github.io/esri-leaflet/examples/styling-feature-layer-points.html
L.esri.featureLayer({
url: 'https://services.arcgis.com/rOo16HdIMeOBI4Mb/arcgis/rest/services/Trimet_Transit_Stops/FeatureServer/0',
pointToLayer: function (geojson, latlng) {
return L.marker(latlng, {
icon: L.icon({
iconUrl: 'https://esri.github.io/esri-leaflet/img/bus-stop-north.png'
})
});
},
}).addTo(map);https://stackoverflow.com/questions/45842299
复制相似问题