简体   繁体   English

放大时不需要的折线扩展名,在Android Map上缩小时消失

[英]Unwanted polyline extension when zoom in and disappears on zoom out on android Map

I connected map locations using Polyline API. 我使用Polyline API连接了地图位置。 It creates polyline properly.But sometimes unwanted polyline extended when zoom in and disappears on zoom out. 它可以正确地创建折线。但是有时不需要的折线会在放大时扩展,并在缩小时消失。

My code: 我的代码:

locations.clear();
            for(int i=0;i<maplatitude.size();i++)
            {
                locations.add(new LatLng(maplatitude.get(i), maplongitude.get(i)));
            }

            PolylineOptions rectOptions = new PolylineOptions();
            rectOptions.addAll(locations);

            // Get back the mutable Polyline
            Polyline polyline = mMap.addPolyline(rectOptions);

            for(int i=0;i<maplatitude.size();i++)
            {
                //mMap.addMarker(new MarkerOptions().position(new LatLng(maplatitude.get(i), maplongitude.get(i))).title(name).snippet(mapdate.get(i)+"\n"+maptime.get(i)));
                mMap.addMarker(new MarkerOptions().position(new LatLng(maplatitude.get(i), maplongitude.get(i))).icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_AZURE)).title(String.valueOf(i)));
            }

I solved this: it's a bug from Google. 我解决了这个问题:这是Google的错误。 We must filter some close points within 1 or 2 meters. 我们必须过滤1或2米以内的一些近点。

Polylines appearing on map where they shouldn't 折线出现在地图上不应出现的位置

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM