mapbox / mapbox-maps-android

Interactive, thoroughly customizable maps in native Android powered by vector tiles and OpenGL.
https://www.mapbox.com/mobile-maps-sdk
Other
475 stars 133 forks source link

How to draw line between two locations (lats/longs) without json file #2033

Closed asifjavaid closed 1 year ago

asifjavaid commented 1 year ago

Hi all,

I am using this sample to draw line between multiple locations. https://github.com/mapbox/mapbox-maps-android/blob/v10.11.1/app/src/main/java/com/mapbox/maps/testapp/examples/linesandpolygons/DrawGeoJsonLineActivity.kt

However I want to draw lines by taping on the mapview and get the location for that point and then draw line to the point where i will again tap on the mapview? So i want to draw lines by locations list with out json file.

Can you please guide us?

Thank you. Asif.

yunikkk commented 1 year ago

@asifjavaid you could use PolylineAnnotationManagers to create polylines without specifying json manually, refer to the example and listen for map taps with mapboxMap.addOnMapClickListener