I have added a providermodel for routing, OpenStreetMap

Topics: Feature Requests
Jul 21, 2010 at 10:08 AM

GMap currently uses Google for routingservices, which is OK as long as you are using Google Maps as maptype. Personally I'd like to use OpenStreetMap maps hence the route can at some times differ from the map.
For this I need to be able to implement my own routing, be it an internet service or local.

So, I decoupled the routing functionality into an interface called IRoutingProvider. All I needed to do then was to implement it using an online OpenStreetMap routing service called YOURS (www.yournavigation.org).

The provider is exposed in GMaps.RoutingProvider. By default it's the Google service.

There is no change in how you request routes, the public methods in Gmaps for routing wraps the selected RoutingProvider. 

For now these services are implemented:

  • Google Maps - Same codebase as before
  • Bing Maps -Not 100% optimal since it does not return point-by-point directions. Need to find another Bing map API call that returns more detailed routes. You need to provide your own ApplicationKey to the routing provider for it to work.
  • YourNavigation - Except that they seem to have some capacity issues at the moment it works perfect with OpenStreetMap map!

Future:

Implent an offline alternative. There are OSM routing apps in Java and C with APIs you can call into to get GPX and KML routes. Even better would be .Net routing with .OSM data and Djikstras algorithm.

This is available in my fork https://hg01.codeplex.com/forks/viktorbergman/viktorbergman

 

I hope you will find it useful :)

 

Coordinator
Jul 21, 2010 at 12:59 PM
Edited Jul 21, 2010 at 6:23 PM

really nice idea, i'll check it as i can

Aug 13, 2010 at 7:08 PM
I was looking for implement YOURS into gmap by my own, but if you already did it ... :) did you release it?
Coordinator
Aug 13, 2010 at 8:17 PM

not yet ;}

Aug 13, 2010 at 8:19 PM
let me know when you'll , please :)
Jul 30, 2011 at 8:18 PM

Hi, any update about using OpenStreetMap for routing?

Coordinator
Jul 30, 2011 at 8:59 PM

still no, i was busy with map providers, i guess, it's time for sub-services too now

Aug 2, 2011 at 11:03 PM

When you say:

Bing Maps -Not 100% optimal since it does not return point-by-point directions. Need to find another Bing map API call that returns more detailed routes. You need to provide your own ApplicationKey to the routing provider for it to work.

I think that the current Bing Route REST API does this:

http://msdn.microsoft.com/en-us/library/ff701717.aspx

This API will give you all the turns and driving instructions you need. It isn't the easiest data structure to work with, but I've used worse. One minor tricky point. In order to show the route on a GMap instance, you will need to request that you want the routePathOutput (routePathOutput=points) and set your tolerances. This will give you a new collection of points for the MapRoute object.

Aug 3, 2011 at 2:09 PM

GMap currently uses Google for routingservices, which is OK as long as you are using Google Maps as maptype. Personally I'd like to use OpenStreetMap maps hence the route can at some times differ from the map.
For this I need to be able to implement my own routing, be it an internet service or local.

So, I decoupled the routing functionality into an interface called IRoutingProvider. All I needed to do then was to implement it using an online OpenStreetMap routing service called YOURS (www.yournavigation.org).

 

Would it be possible to also access the directions via this service?

eg. turn left up This St. Follow for 100m

Coordinator
Sep 19, 2011 at 12:53 PM

i finally managed to add yournavigation.org supprot for OpenStreetMap provider, better later than never ;}