[GIS] Draw route direction overlay on Google Maps or OpenLayers

google mapsopenlayers-2openstreetmapoverlay

I'd like to display the route direction generated from GraphServer on either Google Map or OpenLayers. The result I want is basically identical to how Google Map shows route directions, by highlighting road segments that incorporate the direction. The only difference is that I use GraphServer instead of Google Maps Directions API to generate route direction.

Probably the most trivial approach is to copy over the result from GraphServer, literally point-by-point from every road segments that are part of the route direction, to create polylines or DirectionsStep in Google Maps. But since this task seems to be something that is used often, I wonder if there is any easier approach. It can be either on Google Maps or OpenLayers, whichever is easier to implement.

Best Answer

From Graphserver you get a geoJson formatted file that you will be able to display with openlayers