MKMapView路线/方向 [英] MKMapView Route/Directions
问题描述
我发现Google Maps API支持路线:
var map;
var directionsPanel;
var指示;
函数initialize(){
map = new GMap2(document.getElementById(map_canvas));
directionsPanel = document.getElementById(my_textual_div);
map.setCenter(new GLatLng(49.496675,-102.65625),3);
directions = new GDirections(map,directionsPanel);
directions.load(from:500 Memorial Drive,Cambridge,MA to:4 Yawkey Way,Boston,MA 02215(Fenway Park));
}
那么如何将其转换为Objective-C以便可以通过iPhone?我知道如何在MKMapView上绘制一条线我只需要路线的地理位置。
或者可能有不同的方法来获取两个地理位置点之间的路线。 / p>
请告诉我,
提前致谢。
提到并公开了一个未记录的Google Maps Directions API 这里
另外你应该看一下使用上面提到的API在MKMapView上绘制路线/方向的示例IPhone应用程序此处
但警告您有关许可的信息关于未记录的Google Maps Directions API的问题。
希望这会有所帮助。
I found that the Google Maps API supports Directions through:
var map;
var directionsPanel;
var directions;
function initialize() {
map = new GMap2(document.getElementById("map_canvas"));
directionsPanel = document.getElementById("my_textual_div");
map.setCenter(new GLatLng(49.496675,-102.65625), 3);
directions = new GDirections(map, directionsPanel);
directions.load("from: 500 Memorial Drive, Cambridge, MA to: 4 Yawkey Way, Boston, MA 02215 (Fenway Park)");
}
So how can this be translated into Objective-C so it can be retrieved by the iPhone? I know how to draw a line on MKMapView I just need the geolocations for the route.
Or perhaps there is a different way to get the route between two geolocation points.
Please let me know,
Thanks in advance.
There is an undocumented Google Maps Directions API mentioned and exposed here
Also you should take a look at the sample IPhone application which draws routes/directions onto MKMapView using the API mentioned above here
But warning you about the licencing issues about the undocumented Google Maps Directions API.
Hope this helps.
这篇关于MKMapView路线/方向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!