Leaflet style-and onEachFeature函数读取*geojson文件有什么区别
我使用Leaflet style-and onEachFeature函数读取*geojson文件有什么区别,leaflet,styles,geojson,Leaflet,Styles,Geojson,我使用 $.ajax(overlay).done(function(data) { data = JSON.parse(data); L.geoJson(data, { pointToLayer: pointToLayer, style: style, onEachFeature: onEachFeature }); return}); 据我所知(新手),对于文件中的每个标记,将处理pointToL
$.ajax(overlay).done(function(data) {
data = JSON.parse(data);
L.geoJson(data, {
pointToLayer: pointToLayer,
style: style,
onEachFeature: onEachFeature
});
return});
据我所知(新手),对于文件中的每个标记,将处理pointToLayer-函数,对于每个多边形和线字符串,将处理style函数和onEachFeature函数。对吗?
最后两个函数之间有什么区别(不考虑名称)
格劳斯,王八蛋
pointToLayer
回调函数在所有Point
GeoJSON特性上运行,然后style
函数在所有LineString
和Polygon
GeoJSON功能上运行,然后onEachFeature
回调函数在点(现在是L.Marker
s)和线串/多边形(现在是L.Polyline
s和L.Polygon
s)上运行请注意,
pointToLayer
和style
采用GeoJSON特性作为输入,而onEachFeature
也采用L.Layer
的实例。L.Layer
可以来自调用pointToLayer
或者内部带有样式调用中的信息。返回的最终目的是什么?对不起,应该省略“返回”。