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 am working on a project that requires finding the shortest path and to achieve this, I've used the PgRouting dijkstra function and it's all worked out perfectly.

Initially, the road network was imported using an osm file. The table created consists of multilinestring geometry types.

How can I transform the multilinestring into linestring and give each of them a source id and targer id so that dijkstra function gives the shortest path starting next to the point it has localised.

Thanks all !

share|improve this question

1 Answer 1

Don't do that. You better use tools like osm2pgrouting or osm2po to import OSM data for use with pgRouting.

To find the nearest start and end point you need to use PostGIS functions like "ST_Line_Locate_Point". You can write pl/pgsql wrapper functions to do this or your application can handle it.

share|improve this answer

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.