問題描述
我想用 Leaflet 繪制許多地理點.因此我想使用 HTML5 畫布來提高性能.我的數據源是geoJSON.正如我在 Leaflet 的文檔中看到的,目前還不能將地理位置繪制為畫布.
I want to draw many geo points with Leaflet. Therefore I want to use HTML5 canvas to improve the performance. My datasoure is geoJSON. As I saw in the documention of Leaflet, it is not possible to draw the geo positions as canvas yet.
var anotherGeojsonLayer = new L.GeoJSON(coorsField, {
pointToLayer: function (latlng){
return new L.Marker(latlng, {
icon: new BaseballIcon()
});
}
});
我想我應該在這里聯系:
I think I should hook up here:
pointToLayer: 函數 (latlng) { }
pointToLayer: function (latlng) { }
有人知道如何將我的 latlng 對象繪制為畫布嗎?
Does somebody know how to draw my latlng objects as canvas?
推薦答案
我是傳單作者.您可以通過使用 L.CircleMarker 而不是常規 Marker 來做到這一點,也可以使用實驗性 L_PREFER_CANVAS 開關將矢量渲染為畫布(而不是 SVG),如下所示:https://github.com/CloudMade/Leaflet/blob/master/debug/vector/vector-canvas.html
I'm Leaflet author. You can do this by using L.CircleMarker instead of regular Marker, and also using an experimental L_PREFER_CANVAS switch to render vectors as Canvas (instead of SVG), like this: https://github.com/CloudMade/Leaflet/blob/master/debug/vector/vector-canvas.html
這篇關于傳單 js:將 POI 繪制為畫布的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!