Draw different polylines in Gmaps for Flutter

311

i have found the solution! i called native functions of android and imported the KML import utility natively from android to flutter! enter image description here

Share:
311
Dante Aldebarán Vargas
Author by

Dante Aldebarán Vargas

Updated on December 23, 2022

Comments

  • Dante Aldebarán Vargas
    Dante Aldebarán Vargas over 1 year

    since there is no plugins for open kml files in flutter, i have extracted all the coords and tried to plot them inside a google map using polylines.

    They are 360 pairs of coordinates

    Kml de Google Earth

    i am using this code

     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,
    );
    

    They don't show up inside the map, but if a decrease the number of points in the Set of polylines, they begin to show up

    Otra imagen

    But if a increase these iterations like around 50 different polylines the plot dissapears

    I hope you can help me :)