reactjs - 如何访问/提取我的反应应用程序当前呈现的 GeoJSON?
问题描述
我是 react-leaflet 的新手,我正在尝试访问我的 react 应用程序当前呈现的 GeoJSON(使用 react-leaflet)。更具体地说,我想要下面地图上当前呈现的所有标记的列表。这可能吗?如果可以,怎么做?
export const Map = (props) => {
const classes = useStyles(props)
const editRef = useRef();
return (
<Map
center={[50.725875,-3.555137]}
zoom={19}
maxZoom={19}
minZoom={8}
zoomControl={true}
className={classes.map}
>
<TileLayer
attribution='© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
url="http://{s}.tile.osm.org/{z}/{x}/{y}.png"
/>
<LayersControl position="topright">
<LayersControl.Overlay name="Some Markers...">
<LayerGroup>
<GeoJSON
data={markerData.features}
>
</GeoJSON>
</LayerGroup>
</LayersControl.Overlay >
</LayersControl>
</Map>
)};
解决方案
推荐阅读
- php - Magento2.3.4 调整大小的图像不显示在类别页面、购物车页面、结帐页面和迷你购物车中
- java - 级联 if-else 语句和嵌套 if 语句之间是否存在性能差异
- javascript - 如何使用 document.write 更改文本并删除过去的文本
- android-studio - 更新到 Android Studio 4.1.1
- rust - 如何编写一个宏来返回基于字符串的结构的实现方法?
- r - 另一个向量中特定对象的向量中的第二大值
- mysql - 如何根据第 1 列的值仅获取第 2 列的唯一值?
- php - 使用 laravel api 在 swoole 上启用 https
- python - new_row = dict.fromkeys(df, 0) 语句的问题
- javascript - 使用 react-pdf 和 pdfjs 从 PDF blob 创建图像列表