Reputation: 69
I am working on a bus application and I need to show a route that is used. With that, I used the MapBox website, drew a route using the data set and the logo after I exported a route in .geojson format, I would like to know if I can draw a line on my map on android from this file, instead of placing a point to point in the code.
Upvotes: 0
Views: 814
Reputation: 2546
Yes, a LineString
can be drawn with a Mapbox Maps SDK LineLayer
.
https://github.com/mapbox/mapbox-android-demo/search?q=LineLayer&unscoped_q=LineLayer
You might find these Mapbox demo app examples especially helpful and inspirational:
The Annotation Plugin is another option for drawing lines https://docs.mapbox.com/android/plugins/overview/annotation/. You can use a local file with the Plugin, as seen at https://github.com/mapbox/mapbox-plugins-android/blob/master/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/annotation/LineActivity.java#L89
Upvotes: 2