Leaflet Papa解析-数组到标记
这应该是一个非常快速和简单的。抱歉,如果有一个简单的解决方案。我把文件通读了一遍,但弄不明白 我已经用papa parse解析了一个CSV 我想进一步操纵数组 我怎么 从阵列中创建标记。 通过所述阵列上的Turf进行进一步分析。我知道如何使用Turf,但我是否需要将数组转换为L.geoJson?Leaflet Papa解析-数组到标记,leaflet,papaparse,Leaflet,Papaparse,这应该是一个非常快速和简单的。抱歉,如果有一个简单的解决方案。我把文件通读了一遍,但弄不明白 我已经用papa parse解析了一个CSV 我想进一步操纵数组 我怎么 从阵列中创建标记。 通过所述阵列上的Turf进行进一步分析。我知道如何使用Turf,但我是否需要将数组转换为L.geoJson? 我认为这很容易,但一个小时后,我想不出如何正确使用数组。迭代您的结果并从数组中创建GeoJSON功能/标记 housesGeoJSON = { "type": "Fe
我认为这很容易,但一个小时后,我想不出如何正确使用数组。迭代您的结果并从数组中创建GeoJSON功能/标记
housesGeoJSON = {
"type": "FeatureCollection",
"features": [ ]
}
var lyrHouses = Papa.parse('src/Houses.csv', {
header: true,
download: true,
dynamicTyping: true,
skipEmptyLines: true,
complete: function(results) {
results.data.forEach((house) => {
feature = {
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [house.Longitude, house.Latitude]
},
"properties": {
"Location": house.Location
}
}
marker = L.geoJSON(feature).addTo(map)
// Create geojson of all markers push feature to the declared houses geoJSON
housesGeoJSON.features.push(feature)
})
}
});
这很好用。谢谢-我很惊讶我在搜索中没有发现这个问题,因为我认为这是一个常见的问题。干杯
housesGeoJSON = {
"type": "FeatureCollection",
"features": [ ]
}
var lyrHouses = Papa.parse('src/Houses.csv', {
header: true,
download: true,
dynamicTyping: true,
skipEmptyLines: true,
complete: function(results) {
results.data.forEach((house) => {
feature = {
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [house.Longitude, house.Latitude]
},
"properties": {
"Location": house.Location
}
}
marker = L.geoJSON(feature).addTo(map)
// Create geojson of all markers push feature to the declared houses geoJSON
housesGeoJSON.features.push(feature)
})
}
});