如何在google-map上设置Polyline的方向

时间:2015-12-29 11:19:12

标签: android google-maps-android-api-2

我正在使用此代码从Google获取网址

String str_origin = "origin="+origin.latitude+","+origin.longitude;

// Destination of route
String str_dest = "destination="+dest.latitude+","+dest.longitude;

// Sensor enabled
String sensor = "sensor=false";

// Building the parameters to the web service
String parameters = str_origin+"&"+str_dest+"&"+sensor;

// Output format
String output = "json";

// Building the url to the web service
String url = "https://maps.googleapis.com/maps/api/directions/"+output+"?"+parameters;

return url;

这里考虑谷歌地图方向绘制一条线。 有没有办法可以提供方向(以北为单位)?

1 个答案:

答案 0 :(得分:0)

您可以轻松获取两个位置之间的方位,知道它们的经度和纬度,因此对于方向对象的每一步,计算此链接上显示的方位以了解方向: http://www.movable-type.co.uk/scripts/latlong.html