从 Google 地图中的标记获取坐标(纬度和经度)
Get coordinates (latitude and longitude) from marker in Google Maps
我开始使用很棒的包 react-google-maps。你能帮我如何从插入的(点击的)标记中获取纬度和经度的值吗?
如果我记录返回的对象,我会得到由纬度和经度组成的范围..但我无法访问范围..
我使用与此示例类似的内容 https://tomchentw.github.io/react-google-maps/ 并进行一些更改。我想从点击标记存储在状态纬度和经度。
谢谢。
我假设您想从 state
中的 Marker
列表中获取 longitude/latitude 的列表。
假设 arr
是来自 google 映射的 Marker
的数组:
arr.map(x => x.position.lat())
会给你纬度。
arr.map(x => x.position.long())
会给你经度
我开始使用很棒的包 react-google-maps。你能帮我如何从插入的(点击的)标记中获取纬度和经度的值吗?
如果我记录返回的对象,我会得到由纬度和经度组成的范围..但我无法访问范围..
我使用与此示例类似的内容 https://tomchentw.github.io/react-google-maps/ 并进行一些更改。我想从点击标记存储在状态纬度和经度。
谢谢。
我假设您想从 state
中的 Marker
列表中获取 longitude/latitude 的列表。
假设 arr
是来自 google 映射的 Marker
的数组:
arr.map(x => x.position.lat())
会给你纬度。
arr.map(x => x.position.long())
会给你经度