使用react传单显示GeoJSON中不同类型对象的最有效方法
这是我的GeoJSON示例,它将后端提供给前端使用react传单显示GeoJSON中不同类型对象的最有效方法,geojson,react-leaflet,Geojson,React Leaflet,这是我的GeoJSON示例,它将后端提供给前端 { type: 'FeatureCollection', features: [ { type: 'Feature', properties: { deviceType: 'mine' }, geometry: { type: 'Point', coordinates: [-0.2197265625, 51.27050757321479], },
{
type: 'FeatureCollection',
features: [
{
type: 'Feature',
properties: { deviceType: 'mine' },
geometry: {
type: 'Point',
coordinates: [-0.2197265625, 51.27050757321479],
},
},
{
type: 'Feature',
properties: { deviceType: 'mine'},
geometry: {
type: 'Point',
coordinates: [-0.2327265623, 51.27022757321422],
},
},
{
type: 'Feature',
properties: { deviceType: 'favorite' },
geometry: {
type: 'Point',
coordinates: [-0.263671875, 51.445448545784195],
},
},
{
type: 'Feature',
properties: { deviceType: 'public' },
geometry: {
type: 'Point',
coordinates: [0.10711669921875, 51.43346414054374],
},
},
}
我左右为难,我应该走哪条路:
- 在后端,将响应拆分为多个GeoJSON对象,然后在前端,我可以用标准方式处理每个实例(不太喜欢这个解决方案)
- 发送一个GeoJSON对象,该对象包含my features的所有变体,并在前端地图上通过features对其进行分组