我是传单和R的新手。 我正在尝试用R(传单和闪亮)创建交互式地图。我基本上需要在地图上跟踪带有点的路线。数据来自GeoJSON文件,其中包含需要用于样式选项的属性。在html中使用传单的早期实现如下所示:
L.geoJson(route2aug,{
style: function (feature) {
return feature.properties && feature.properties.style;
},
pointToLayer : function(feature,latlng){
var popupContent = "Sootmass:" + String(feature.properties.sootmass);
var popupOptions = {maxWidth: 200};
return L.circleMarker(latlng,{
radius: 4,
fillColor: getColor(feature.properties.sootmass),
color: getColor(feature.properties.sootmass),
weight: 1,
opacity: 1,
fillOpacity: 0.8
}).bindPopup(popupContent, popupOptions);
}
}).addTo(map);
此处,数据来自route2aug文件,该文件作为js对象导入。我需要在R中用传单复制这个。 有没有办法在R中做同样的事情? GeoJSON数据文件如下所示:
{"geometry": {"type": "Point", "coordinates": [77.68137666666667, 12.926686666666667]}, "type": "Feature", "properties": {"sootmass": 5}},{"geometry": {"type": "Point", "coordinates": [77.68138666666667, 12.926686666666667]}, "type": "Feature", "properties": {"sootmass": 10}},{"geometry": {"type": "Point", "coordinates": [77.681405, 12.926688333333335]}, "type": "Feature", "properties": {"sootmass": 15}}.......}