Posts

Showing posts with the label dijkstra

How to find the shortest path from an Internet Zoo topology file throught Postgis/pgrouting

Image
First, you need to download a topology from Internet zoo. I will use Napnet as example: wget  http://www.topology-zoo.org/files/Napnet.graphml Now, we need to convert graphgml to sql (to load from postgres). To do it, you can use simplekml library for python or pykml. It's important use geographic coordinates without altitude value and only write edges in the kml file. After, you can follow this post  to convert from kml to sql. To begin, first we need to create a database and create a password (usually is postgres) for postgres user: sudo -u postgres createdb testing sudo -u postgres psql   postgres=# \password postgres Enter new password:  Enter it again:  postgres=# \q Now, load the sql query: psql -U postgres -d testing -q -f "Napnet.sql" psql: FATAL:  Peer authentication failed for user "postgres" To avoid this issue, you can run it throught this way: psql 'host=localhost port=5432 dbname=testing user=postgres' -q -f ...