Search code examples
androidgoogle-mapskotlindirections

Google maps directions - spaces between polylines


I am facing this ugly problem, can anyone solve this ? I want to get rid of that ugly spacec between lines. I need to keep the width.enter image description here

code(adding polylines) :

thread {
        val response = getResponse(points[1].location, points[2].location, "driving21.").log()
        when (response) {

            is Result.Failure -> "Fail".log()

            is Result.Success ->
                response.value.routes[0].listOfLegs[0].listOfSteps.forEach { element ->
                    //                    element.points.log()
                    val options = PolylineOptions()
                    options.color(Color.rgb(255, 26, 140))
                    options.width(50F)
                    options.addAll(PolyUtil.decode(element.points))
                    runOnUiThread {
                        map.addPolyline(options)
                    }
                }
        }

EDIT:

after adding .jointType(JointType.ROUND)
there is another problem


Solution

  • .jointType(JointType.ROUND) Adding this line should do it for you