How to draw the marker on the center of the polyline
Asked Answered
N

4

5

I am working on google maps and location listener. I am drawing the polyline on the map with my movement using location listener. Now i want the starting point and the current position on the polyline. I am setting the customized icon as a marker but it appears on the left side of the polyline. I want it exact in the center and the ending point of the polyline. Any Solutions,,??

What i want

What is the problem

Nanettenani answered 23/11, 2016 at 11:42 Comment(1)
I don't want marker shape, i just want a white spot to appear on the polyline. But it is considering the spot as marker and because that spot don't have sharp tip so that's why the circle appear out off the Boundary.Nanettenani
N
7

In this case, you can set the marker anchor. mMap.addMarker(new MarkerOptions().anchor(0.5f, 0.5f).position(latLngArrayList.get(0)).icon(startPointIcon).title("Start"));

Nanettenani answered 26/2, 2017 at 7:9 Comment(0)
C
2

Check this :

http://android-er.blogspot.in/2013/01/google-maps-android-api-v2-example_5213.html

hope it will help you.

According to Marker , your maker is not designed properly, you should design marker in must a way that i comes over the point..

enter image description here this is the reason they keep marker in this shape

Contrayerva answered 23/11, 2016 at 11:46 Comment(2)
I don't want marker shape, i just want a white spot to appear on the polyline. But it is considering the spot as marker and because that spot don't have sharp tip so that's why the circle appear out off the Boundary.Nanettenani
Mudasir, your marker can be any shape. Create a white circle as a drawable and use that as a your marker.Bink
C
2

Instead of using your image use marker provided by google which would solve your problem....Or else if you want custom marker with a pointy end...

Caulfield answered 23/11, 2016 at 11:50 Comment(5)
I don't want marker shape, i just want a white spot to appear on the polyline. But it is considering the spot as marker and because that spot don't have sharp tip so that's why the circle appear out off the Boundary.Nanettenani
The image on a marker is called its 'icon'. A marker is also known as a 'pin'.Caulfield
You need to update the icon based on your requirements.Caulfield
This is the main problem. You see the marker which google use by default it has different shape. But i am just using a circle.It just the adjustment.Nanettenani
Yeah i also think so. This is icon shape change i think.Nanettenani
L
0

Issue with polyline draws for outdoor latlngs and your markers latlngs are for indoor position. Change your maker positions with outdoor street positions and it will work.

Laith answered 23/11, 2016 at 11:59 Comment(1)
I don't want marker shape, i just want a white spot to appear on the polyline. But it is considering the spot as marker and because that spot don't have sharp tip so that's why the circle appear out off the Boundary.Nanettenani

© 2022 - 2024 — McMap. All rights reserved.