I created my path in QGIS v2.18.18, making the lines and a combination of cleaning tool and explode lines tool to get my desired output. I tried using ROAD GRAPH plugin in order to check whether my path works when getting the shortest path, and it does. So I used GDAL to put the shp file to my pgadmin, and then using pgr_createTopology() doesnt give me the correct output. The following is an image of my table.

enter image description here

and here is the the command I ran for it.

SELECT pgr_createTopology('edges', 0.001, 'the_geom', 'gid');

I tried changing my EPSG:4326 to EPSG:3587 when I'm importing my SHP file in postgres as seen below. and after importing the file, and creating the topology again it gives me my desired output. you can then change your EPSG to your desired one.

ogr2ogr -f "PostgreSQL" "PG:host=localhost user=postgres dbname=routing 
password=password" "F:\paopao theis files not to be 
deleted\Pryce(thesis)\finallines.shp" -t_srs EPSG:3857 -lco GEOMETRY_NAME=the_geom - 
lco FID=gid -lco PRECISION=no -nlt PROMOTE_TO_MULTI -nln edges -overwrite

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.