javascript - React-Native-Maps how to draw polylines - Stack Overflow

I've started usingand having no luck drawing polylines from an array of array coordinates on the

I've started using and having no luck drawing polylines from an array of array coordinates on the map.

I am not sure if I'm passing in the array of coordinates correctly.

this is how I am rendering the polyline:

      {this.state.polylines.map(polyline => (
        <MapView.Polyline
          key={polyline.id}
          coordinates={polyline.coordinates}
          strokeColor="#000"
          fillColor="rgba(255,0,0,0.5)"
          strokeWidth={1}/>
      ))}

polyline.coordinates looks like:

      [[lat,lng],[lat,lng],[lat,lng]]

Thank you for any help/advice :D

I've started using https://github./airbnb/react-native-maps and having no luck drawing polylines from an array of array coordinates on the map.

I am not sure if I'm passing in the array of coordinates correctly.

this is how I am rendering the polyline:

      {this.state.polylines.map(polyline => (
        <MapView.Polyline
          key={polyline.id}
          coordinates={polyline.coordinates}
          strokeColor="#000"
          fillColor="rgba(255,0,0,0.5)"
          strokeWidth={1}/>
      ))}

polyline.coordinates looks like:

      [[lat,lng],[lat,lng],[lat,lng]]

Thank you for any help/advice :D

Share Improve this question asked Oct 13, 2016 at 11:57 douglaswissettdouglaswissett 2411 gold badge4 silver badges14 bronze badges 1
  • How did you get the Array of Lat and Lng ??? [ [lat,lng ],[lat,lng ] ] . .??\ – Beckham_Vinoth Commented Oct 3, 2017 at 9:34
Add a ment  | 

1 Answer 1

Reset to default 2

I think the coordinates must be an array of type LatLng as it is documented in the API.

How LatLng objects are created can be found in the ponent MapMarker for example. Here you can find the source code (linked to the relevant line) and the ponent API.

Hope this will help you,
Marius

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744248613a4565057.html

相关推荐

  • javascript - React-Native-Maps how to draw polylines - Stack Overflow

    I've started usingand having no luck drawing polylines from an array of array coordinates on the

    8天前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信