在 Gmaps for Flutter 中绘制不同的折线

Draw different polylines in Gmaps for Flutter

由于在 flutter 中没有用于打开 kml 文件的插件,我提取了所有坐标并尝试使用折线将它们绘制在 google 地图中。

它们是360对坐标

我正在使用这个代码

 List<LatLng> tempList = new List<LatLng>();
  for (int i = 0; i <11; i+=2) {
  tempList.clear();
  tempList.add(listaCoords[i]);
  tempList.add(listaCoords[i+1]);
  _circuito1.add(Polyline(
    polylineId: PolylineId(i.toString()),
    points: tempList,
    color: Colors.redAccent.shade700,
    width: 10,
    visible: true,
    geodesic: true,
  ));
}
setState(() {
  lineas.clear();
  lineas.addAll(_circuito1);  
});
//Más código....

return GoogleMap(
  mapType: MapType.hybrid,
  initialCameraPosition: _kGooglePlex,
  onMapCreated: _onMapCreated,
  markers: _markers,
  polylines: lineas,
);

它们不会出现在地图内部,但如果减少折线集中的点数,它们就会开始出现

但是如果增加这些迭代,比如大约 50 条不同的多段线,情节就会消失

希望你能帮助我:)

我找到了解决办法!我调用了 android 的本地函数,并从 android 本地导入了 KML 导入实用程序以进行 flutter!