I currently use pgr_tsp and returns the list (apparently) correct. But I find no reference on how to get the lines that make up the optimal route. Is it possible that can help me?

enter image description here

I only need to finish creating the "optimal" route mode lines.

Use as a reference: http://docs.pgrouting.org/2.0/es/src/tsp/doc/index.html#pgr-tsp


Do you have a geometry column in your table ? if so you can join it to the result of the pgr_tsp.

If the geometry you are using is linestring then you can join on the lines having source and destination shown on the result of pgr_tsp

else if your geometry is point ( vertices) then you can join by ID and create your own linestring.

if you don't have any geometry column in your table then you'll have to make one since you have the x and y coordinates

pgrouting is a great tool for Geographic routing, always remember to leave a geometry column to use it for results

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.