您的代码很好,但多段线点的坐标不好:使用WGS 84 Web的Google地图
Mercator projection
截断纬度为
Latmax = ±85.05113°
,所以没有坐标点
LatLng(95, 50)
(
95
-对于纬度来说太大)和
LatLng(90, 55)
和
LatLng(100, 50)
.您的坐标应来自
(-89.99,-179.99)
到
(89.99,179.99)
.尝试,例如使用
55, 60
和
70
而不是
95, 90
和
100
:
private Polyline polyline;
public void OnMapReady(GoogleMap map)
{
_map = map;
_map.MyLocationEnabled = true;
_map.TrafficEnabled = true;
_map.SetIndoorEnabled(true);
PolylineOptions poly = new PolylineOptions()
.InvokeColor(Color.Red)
.InvokeWidth(5)
.Visible(true)
.InvokeZIndex(30);
poly.Add(new LatLng(55, 50));
poly.Add(new LatLng(60, 55));
poly.Add(new LatLng(70, 50));
polyline = _map.AddPolyline(poly);
_map.MyLocationChange += MyLocationChanged;
}