在iPhone SDK中在MapKit中绘制路线 [英] Drawing a route in MapKit in iPhone SDK

查看:54
本文介绍了在iPhone SDK中在MapKit中绘制路线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在地图上的两个位置之间绘制路线。像导游一样的东西。当游客点击另一个位置时,我希望能够画一条路线;以及通知当前位置的距离。

I want to draw a route between two locations on the map. Something like a tour guide. When the tourist clicks another location, I want to be able to draw a route; as well as, inform about the distance from the current location.

我知道互联网上的网站告诉我们如何在地图上绘制折线。但是,大多数示例都有一个带有各种坐标的预加载的.csv文件。

I am aware of sites on the Internet which tell how to draw polylines on map. But, most of the examples had a preloaded .csv file with various coordinates.

是否有另一种方法可以从Google或任何其他提供商处获取坐标作为位置是动态选择的。

Is there an alternative way to get the coordinates from Google or any other provider, as the location is selected dynamically.

如果否,我如何获取中间坐标的信息?

If NO, how do I get the information for intermediate coordinates?

iOS 6吗?为这个问题提供任何直接的方法吗?

Does iOS 6 provide any direct way for this problem?

推荐答案

这是一个棘手的问题。使用MapKit无法做到这一点:当您知道坐标时,很容易绘制线条,但MapKit不会让您访问道路或其他路线信息。我要说你需要调用外部API来获取数据。

This is a tricky one. There is no way to do that with MapKit: it's easy enough to draw lines when you know the coordinates, but MapKit won't give you access to the roads or other routing information. I'd say you need to call an external API to get your data.

我一直在玩cloudmade.com API。矢量流服务器应该返回您需要的内容,然后您可以在地图上绘制它。但是,Google地图与cloudmade使用的 OSM 地图之间的差异可能会让您想要使用cloudmade地图:它们与MapKit相当。

I've been playing with cloudmade.com API. The vector stream server should return what you need, and then you can draw that over your map. However, discrepancies between the Google maps and the OSM maps used by cloudmade may make you want to use cloudmade maps all the way: they have an equivalent to MapKit.

PS:其他地图提供商 - Google,Bing等也可能提供相同的数据Feed。我最近一直在关注OSM / Cloudmade。

P.S.: Other mapping providers - Google, Bing, etc. may also provide equivalent data feeds. I've just been looking at OSM/Cloudmade recently.

P.P.S:这些都不是新手的琐事!祝你好运!

P.P.S.: None of this is trivial newbie stuff! Best of luck!

这篇关于在iPhone SDK中在MapKit中绘制路线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆