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 used osm2pgsql to convert osm data to postgresql. Now I have a table with edges and they have geometry like multilinestring. I am not sure what is meant be geometry of an edge. An edge is supposed to be a line between two points/nodes(start and end). How does the geometry thing come in? Can anyone please elaborate? And I want to know if routing functions like pgRouting actually use this geometry when calculating/displaying the shortest route?

share|improve this question
A beginners guide to pgrouting: underdark.wordpress.com/2011/02/07/… –  Mapperz May 30 '12 at 15:34

1 Answer 1

An edge contains a source and target, which describes your route-able network. For Dijkstra algorithm this is sufficient. A-Star and Shooting Star algorithm have a heuristic component and make use of the geometry of source and target (x1,y1 and x2,y2). Source and target coordinates are pre-calculated for better performance.

The geometry (ie. multilinestring) is necessary for example to render the route, or to extract source and target points. It is not necessary for the shortest path algorithm.

share|improve this answer
That's what I am asking how the geometry is used while rendering the route. I have the geometry but how am I supposed to use it while displaying the route –  rajan sthapit May 30 '12 at 20:10
Well, you didn't ask this. But how you render the route depends on what software you use for rendering. pgRouting only returns you an SQL result set. You can take a look at the workshop and see how you can return the SQL result as GeoJSON and render it as vector layer in OpenLayers. –  dkastl May 30 '12 at 20:17
This is the workshop link: workshop.pgrouting.org –  dkastl May 30 '12 at 20:17
Actually, I don't want to use openlayers. Is there any way to return the results in gpx format. I mean how can I convert the multilinestring so that it can be represented in gpx format –  rajan sthapit May 31 '12 at 4:19
GPX doesn't know linestrings. And you can't directly use the SQL output but need to parse the geometry and create a GPX track segment for each linestring: topografix.com/gpx/1/1/#type_trksegType –  dkastl May 31 '12 at 7:47

Your Answer


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.