[postgis-users] [shp2pgsql] Polyline with internal intersection nodes affect Djikstra Routing

Noah palmnoah at gmail.com
Wed Jun 7 12:01:01 PDT 2006


I create my maps using GPSmapedit then convert it to shape files using
cgpsmapper. Finally the data is loaded into pgsl using shp2pgsql.

The problem I'm facing is that I cannot use the shortest_path function (from
Djikstra by Cartoweb) as my polyline contains internal intersections. Short
of manually splitting up all my polylines at intersections, how can I ensure
that the shortest_path function would work with internal intersections?

FYI, the line shapefile output by cgpsmapper does not contain source_id,
target_id or edge_id. This is handled quite well by the assign_vertex_id
function for roads which intersects at the beginning and end nodes. But
assign_vertex_id does not work with roads that intersect in the middle.

I'm thinking if I altered shp2pgsql to break linestrings at internal nodes,
this would solve the routing problem. So if Road A with nodes (a,b,c) joins
Road B with nodes (b,d), shp2pgsql would create 3 rows of data to allow the
shortest_path function to work:

1 Road A (a,b)
2 Road A (b,c)
3 Road B (b,d)

Am I approaching this problem from the wrong angle?

Thanks in advance for any help offered.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20060608/5b94cf09/attachment.html>

More information about the postgis-users mailing list