0

I have looked for hours for what seems like it should be a trivial task. I simply want to draw a route through a series of waypoints (which I have as both address strings and geoCoordinates).

The Imagery API lets me do a query for a static map, which seems to be a common solution, but I was hoping to draw the route on the dynamic, interactive map provided by the Bing Maps iOS SDK.

Thank you.

zivarah
  • 199
  • 2
  • 8
  • [looks like Bing is charging $40 per month for developers to use their services, b.t.w.](http://www.bing.com/community/site_blogs/b/developer/archive/2012/04/12/bing-dev-update.aspx) -- is that something you (or client) can afford? – Michael Dautermann Apr 22 '12 at 01:29
  • Well, that's a recent change... Regardless, that is not an issue for me currently, as the transition should take a while (and I just need this to work for a few more days, after that I can try to find an alternative). Problem is, I am currently using various other parts of the Bing API and can't _really_ afford to switch just yet. – zivarah Apr 22 '12 at 01:39

1 Answers1

0

"draw the route on the dynamic, interactive map provided by the iOS SDK." Is this to say that you want to use MapKit on the iPhone?

If that's the case then you can look at this: http://iphonegeeksworld.wordpress.com/2010/09/08/drawing-routes-onto-mkmapview-using-unofficial-google-maps-directions-api/

The only problem with that is that you need to decode the polylines, which you can do by following links in that link and modifying that code to suit yourself.

prince
  • 506
  • 6
  • 18
  • Sorry, I meant the interactive map provided by the Bing Maps iOS SDK. Edited question to reflect that. My understanding is that MapKit would draw a route over a MapView. The BMMapView class, however, inherits from UIView, not MKMapView: `@interface BMMapView : UIView` – zivarah Apr 22 '12 at 12:52
  • ahhhh. well I'd suggest moving away from Bing altogether tbh. – prince Apr 22 '12 at 14:08
  • Unfortunately, the alternative doesn't seem too bright. I am working with public transit directions, which the Google API does not support. I tried [this hack](http://stackoverflow.com/questions/2689542/how-to-get-google-maps-public-transit-directions-by-http-server-side-request), but that does not return true json, it returns javascript which cannot trivially be converted to json. – zivarah Apr 22 '12 at 14:21
  • [pastebin](http://pastebin.com/U1QYiBGr) The formatting isn't pretty, sorry. The main problem is the JavaScript control structures (easy enough to strip) The other problem is that while all JSON is valid javascript, all javascript is NOT valid JSON. In particular, JSON requires "quoted_string":"quoted_string", whereas that output has unquoted_string:"quoted_string" – zivarah Apr 22 '12 at 15:12
  • It seems to me that all of the information needed is contained on that huge line. However I do not know how one would decode that, nor can I find anything on the topic elsewhere. Also, most of what you posted is irrelevant calls to show images etc. – prince Apr 22 '12 at 15:47
  • All the information is there, but a JSON parser can't handle it. Extracting everything will be a mess, to say the least. – zivarah Apr 22 '12 at 17:19
  • It will be, but I can't think of another alternative. – prince Apr 22 '12 at 17:37