react-native - 我想在谷歌地图中使用纬度和经度在反应原生中绘制多边形
问题描述
如何使用本机反应在谷歌地图中绘制多边形。我有一个纬度和经度的数组列表我想使用纬度和经度在谷歌地图中绘制多边形。
解决方案
这是答案
<MapView>
<Polygon
coordinates={[
{ latitude: 37.8025259, longitude: -122.4351431 },
{ latitude: 37.7896386, longitude: -122.421646 },
{ latitude: 37.7665248, longitude: -122.4161628 },
{ latitude: 37.7734153, longitude: -122.4577787 },
{ latitude: 37.7948605, longitude: -122.4596065 },
{ latitude: 37.8025259, longitude: -122.4351431 }
]}
strokeColor="#000" // fallback for when `strokeColors` is not supported by the map-provider
strokeColors={[
'#7F0000',
'#00000000', // no color, creates a "long" gradient between the previous and next coordinate
'#B24112',
'#E5845C',
'#238C23',
'#7F0000'
]}
strokeWidth={6}
/>
</MapView>
推荐阅读
- java - 我可以在 AsciiDoctor 文档中包含 Java 常量值吗?
- python - 右键单击QTableView的未占用区域时如何触发事件
- amazon-web-services - AWS ElasticSearch - 添加两个数据节点后节点数翻倍
- windows - 使用快捷键/热键将打开的窗口重新排列到监视器
- sql - 连接两个没有唯一标识符的数据表
- c++ - 动态绑定和虚函数——基类对象的向量,访问“正确”的成员函数
- regex - 验证特定标识符模式
- sql - 如何在 SQL 中获取日期差异?
- javascript - 从 JS(浏览器)创建和下载一个 UTF8 纯文本文件
- azure-data-factory - 如何将CSV复制到ADF中具有带点的列标题的Json?