| Issue 5313: | Bug: Polylines drawn incorrectly in certain cases | |
| 51 people starred this issue and may be notified of changes. | Back to list |
Certain kinds of polylines are drawn incorrectly in certain zoom levels. The behavior is only visible if you zoom near enough, at higher levels polyline is drawn correctly. Our application uses GPS locations to draw polylines and the drawing issues seem more common when a device has been standing still for a while and draws a lot of jittery lines around it. Attached some screenshots and a sample Java-file that contains example data and a PolylineBugData.createBuggyPolyline() method which can be used to reproduce the behavior. The data was randomly generated to exhibit the bug because extracting real data which causes the issue would be more difficult. It is probably also possible to remove points from the attached sample data and still retain the buggy behavior. The bug is present at the "February 2013" release of Google Maps v2 and shows up at least on these devices: -Samsung Galaxy S (2.3.3) -Samsung Galaxy Mini (2.3.4) -Galaxy Nexus 4 (4.2.1) -Galaxy Nexus 7 (4.2.2) -Samung XCover (2.3.6) ********************************************************* For developers viewing this issue: please click the 'star' icon to be notified of future changes, and to let us know how many of you are interested in seeing it resolved. *********************************************************
Apr 26, 2013
#1
[email protected]
May 27, 2013
I have also come across this bug, also on relatively jittery data recorded while standing still, or walking back and forth in a 1-2m area. Additional info: - The artefact (bug) line always appears to leave my drawn route heading due North, East, South or West. Direction can switch based on zoom. - The artefact only appears when the zoom is pushed to quite high (approx 2 highest) levels, but will then remain for considerable zoom out actions before eventually disappearing again. - Seen on HTC Desire, Android v2.2
May 27, 2013
http://stackoverflow.com/questions/16740262/its-a-bug-or-something-wronggoogle-map-v2-for-android
Jul 2, 2013
I have also come across this, I don't think its just when you zoom in, I have found that it happens with different amounts of data and also different zoom levels (about 11 and 8) how ever it can be reproduced by going in to the same position and zoom level, you can also follow line line for quite some time and then it disappears
Jul 2, 2013
This was on a Samsung Galaxy Nexus running 4.2.2
Jul 5, 2013
I have implemented a filter to skip points closer than 1 metre, and that seems to have eradicated the problem. I haven't adjusted the threshold to see if it works on less. It is extra processing I'd rather not be doing. Has anyone found any other work arounds?
Jul 5, 2013
Is that what causes it? When there is a abundance of points in one place?
Sep 24, 2013
Is there any resolution for this issue? I'm having some of the same issues, particularly at screen/projection edges.
Sep 24, 2013
http://stackoverflow.com/questions/17422314/polylines-appearing-on-map-where-they-shouldnt You have to filter out lines that are too close to each other.
Jan 26, 2014
I could track it down to a very simple case with only 4 points. (Indeed the last point is not even needed). See: http://stackoverflow.com/questions/21361069/cant-draw-an-arrow-using-polyline-in-googlemap-v2 In this case it has nothing to do with points being very near, but just with the fact, that the same segment is drawn once to west and then back to east. And it only happens if the segment goes absolutely straight towards west and east. The same code works, if the segment goes only a bit towards north or south in addition.
Jan 26, 2014
Just wanted to add the example code also here.
Resulting shape should be a kind of arrow, but the horizontal line extends to infinity.
PolylineOptions po = new PolylineOptions();
LatLng p1 = new LatLng(49.4, 8.45);
LatLng p2 = new LatLng(49.3, 8.6);
LatLng p3 = new LatLng(49.3, 8.5);
LatLng p4 = new LatLng(49.35, 8.6);
po.add(p1);
po.add(p2);
po.add(p3);
po.add(p2);
po.add(p4);
map.addPolyline(po);
Feb 24, 2014
It seems to be when a path crosses back over itself. For me it happens when a user needs to make a u-turn. My attempt to work around the issue has lead me to introduce a bit a randomization to the polyline:
Random rand = new Random();
foreach (var vertice in path)
{
double lat = vertice[0];
double lng = vertice[1];
lat = lat + rand.NextDouble() / 10000;
lng = lng + rand.NextDouble() / 10000;
....
Not perfect, but seems to be working.
Sep 11, 2014
(No comment was entered for this change.)
Status:
Acknowledged
Labels: Internal-17479064
Oct 24, 2014
Stumbled with this issue when requesting small route too GoogleDirectionsApi. Any workaround still? Already like one year past.
Mar 4, 2015
Same here. I've tried to filter points too close to each other, but the problem still occurs. The only things that makes sense is that it happens when the polyline makes a u-turn. Bu I cannot add randomization. I need to put the points exacly where they are.
Mar 4, 2015
A not so beautiful workaround that worked for us: alter the similar coordinates with a value less than you position error tolarence, so that they won't be exactly the same. For us a value like 0.000001 worked fine. So the example in comment #11 would look like:
PolylineOptions po = new PolylineOptions();
LatLng p1 = new LatLng(49.4, 8.45);
LatLng p2 = new LatLng(49.300001, 8.600001);
LatLng p3 = new LatLng(49.3, 8.5);
LatLng p4 = new LatLng(49.35, 8.6);
po.add(p1);
po.add(p2);
po.add(p3);
po.add(p2);
po.add(p4);
map.addPolyline(po);
This way the lines will look the same on screen, but you won't encounter the problem. Of course, this needs a little extra logic, to determine the points that have the sam e coordinates.
Mar 4, 2015
I'm working on a tablet with xhdpi density screen and I'm discarding from my dataset the points with the same latitude and longitude of the previous one. The bug occurs when two points making a u-turn (horizontal or vertical) have a distance of 0.000001. So the solution suggested in #17 won't work, or at least should consider to add an offset proportional to the screen density. But keep in mind that, for me, neither the solution of computing the distance from the last point and discard the closest one ( < 1 meter) worked. I think it's not a problem of distance. In other situations, where there are two points very close but not u-turning, the issue is not occurring.
May 8, 2015
Is there any solid fix for this bug now?
Jun 22, 2015
Issue 8010 has been merged into this issue.
Jun 22, 2015
Issue 8166 has been merged into this issue.
Jun 24, 2015
Issue 7483 has been merged into this issue.
Nov 17, 2015
Up
Feb 11, 2016
having this same problem on Nexus 6 running 6.0.1
Feb 17, 2016
I managed to reproduce this error for the last 2 years, on several phones. The smallest way to reproduce this is:
LatLng p1 = new LatLng(32.084, 34.806);
LatLng p2 = new LatLng(32.086, 34.806);
LatLng p3 = new LatLng(32.086, 34.807);
polyline.add(p1);
polyline.add(p2);
polyline.add(p1); // this one messes up
polyline.add(p3);
LatLngBounds.Builder bounds = new LatLngBounds.Builder();
bounds.include(p1).include(p2).include(p3);
mGoogleMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds.build(), 100));
Again, the workaround is to remove some points from my line. In my case the tolerance is 0.001. I am not happy about "not displaying" the correct data (even though I know the points are bellow the GPS accuracy, so ignoring them is not a bad idea anyway).
Mar 24, 2016
Up. Same on Galaxy Google Nexus. |
|
| ► Sign in to add a comment |