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.

  • What data format does GraphServer generate? Mar 10, 2011 at 11:41

1 Answer 1


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

  • I searched through Graphserver source but couldn't find where it outputs geoJson. Could you please point me to that particular function?
    – ejel
    Mar 10, 2011 at 19:12
  • No, but I can point you to the document I read it cete-mediterranee.fr/tt13/www/IMG/pdf/sujetcete-graphserver.pdf (in french). A web service is embedded in the app and seems to send a response formatted into geojson. If you're not able to find about that you should maybe ask to the graphserver googlegroup.
    – simo
    Mar 10, 2011 at 21:52
  • After looking into the code, though Graphserver (particularly its gs_routeserver) produces json output, the output format is not GeoJSON (as it contains richer info regarding directions). However, it can be configured to output coordinates along with its json output. Then, it is straightforward enough to create GeoJSON object from the output.
    – ejel
    Mar 10, 2011 at 22:45
  • 2
    And for those who're interested, if you want to render GeoJSON on Google Maps, GeoJSON to Google Maps may come in handy.
    – ejel
    Mar 10, 2011 at 22:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.