如题,项目中需要在地图中展示两个不相交的区域图,polygons不能传入二维数组
[
[{"latitude":37.47077013014,"longitude":118.49767926179},{"latitude":37.432457240024,"longitude":118.48938594907},{"latitude":37.428655126566,"longitude":118.57178934625},{"latitude":37.468315919547,"longitude":118.57376468984},{"latitude":37.47077013014,"longitude":118.49767926179}],
[{"latitude":37.468768182012,"longitude":118.69943023913},{"latitude":37.469911014572,"longitude":118.59842457958},{"latitude":37.423987827154,"longitude":118.60317761288},{"latitude":37.423355263897,"longitude":118.70017807125},{"latitude":37.468708907456,"longitude":118.69928696059}]
]
以上是需要画圈的两个坐标数组
二维数组地图上是不显示的,怎么才能显示两个多边形呢
可以的,看代码片段 :https://developers.weixin.qq.com/s/jmdTOpmA7TBU
你把该数组的0号元素,赋值给polygons[0].points 字段,把数组的1号元素,赋值给polygons[1].points 字段 就可以了