Closed KristinnGodfrey closed 1 month ago
My current implementation is to googleMap.clear()
and then add everything to the map again. That doesn't seem very efficient. Code for reference:
override fun onInfoWindowClick(p0: Marker) {
val mapFragment = supportFragmentManager.findFragmentById(R.id.map) as SupportMapFragment
val homeLatLng = LatLng(64.13963469616142, -21.9518070894305)
mapFragment.getMapAsync { googleMap ->
googleMap.clear()
addMarkers()
map.addMarker(MarkerOptions().position(LatLng(64.13963469616142, -21.9518070894305)))
googleMap.run {
//Called the drawRouteOnMap extension to draw the polyline/route on google maps
drawRouteOnMap(
mapsApiKey=getString(R.string.google_maps_key), //your API key
source = homeLatLng, // Source from where you want to draw path
destination = p0.position, // destination to where you want to draw path
markers = false,
travelMode = TravelMode.WALKING,
context = this@MainActivity //Activity context
)
}
}
}
Hay @KristinnGodfrey thanks man, sounds really a good option to have. I would love to work on it.
Any update on this? Love the library, thanks a lot for the great work! This feature (Being able to remove them again would be very helpful for us as well since we keep updating the route from the current user location to the destination. We have over 300 markers on the map and always removing and readding them slows things down quite a bit...
Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':app:debugCompileClasspath'. = maven { url = uri("https://jitpack.io") }
Sorry guys, i know it's too late but this new release: worth a look https://github.com/malikdawar/drawroute.
Changelog: 1- Added the remove path feature 2- Optimized the response time with the help of Kotlin coroutines 3- Remove the dependencies on Rx, that was making the build heavy.
I want to clear a drawn route before drawing another one. For all I can see, there is no way that handles that scenario.