Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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 Map's 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 Map. 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 OpenLayer, whichever is easier to implement.

share|improve this question
    
What data format does GraphServer generate? –  geographika Mar 10 '11 at 11:41

1 Answer 1

up vote 4 down vote accepted

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

share|improve this answer
    
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 '11 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 '11 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 '11 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 '11 at 22:50

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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