How to Draw Polyline between two markers or coordinates on mapmyindia using React Native?

35 Views Asked by At

How to draw poly line between two markers or coordinates in mappls-map-react-native. Please find the below sample code which is tried. I can't find any sample from in official doc.

"react-native": "0.72.7",
"mappls-map-react-native": "^1.0.6"

let route = {
        "type": "FeatureCollection",
        "features": [
          {
                "type": "Feature",
                "properties": {},
                "geometry": {
                "type": "LineString",
                "coordinates": [
                        [
                             19.2052853,
                             72.8708257
                        ],
                        [
                             12.991463333333334,
                             77.70299666666666
                        ]
                ]
                }
          }
        ]
  }
<MapplsGL.MapView
      style={{flex: 1}}
      zoomEnabled={true}
      onPress={event => console.log('event', event)}>
      <MapplsGL.Camera
       ref={c  => (this.camera = c)}
          zoomLevel={13}
          animationMode="easeTo"
          centerCoordinate={[long, lat]}
      />
      <MapplsGL.ShapeSource id='line1' shape={route}>
             <MapplsGL.LineLayer id='linelayer1' style={{lineColor:'#ff0000'}} />
     </MapplsGL.ShapeSource>
     <MapplsGL.UserLocation visible={true}></MapplsGL.UserLocation>
</MapplsGL.MapView>
0

There are 0 best solutions below