1. Using Qgis

../_images/route.png

Other kind of functions are pl/pgsql. As applications requirements become more complex, using previously defined functions becomes necessary.

1.1. Set Up QGIS

Graphs have a set of edges and set of vertices associated to it. osm2pgrouting provides the ways_vertices_pgr table which is associated with the ways table. When a subset of edges is used like in vehicle_net or in small_net, the set of vertices associated to each one must be used in order to, for example, locate the nearest vertex to a lat/lon location.

  1. Launch QGIS from Geospatial ‣ Desktop GIS ‣ QGIS and select Project ‣ Open from the menu bar.

    ../_images/qgis1.png

    Note

    The location of QGIS may vary.

    The workshop instructions are based on QGIS 2.14 Essen

    ../_images/qgis2.png
  2. Close the broswer pannel

    ../_images/qgis3.png
  3. Connect to a posgGIS enabeled potsgreSQL database clicking on Add postGIS layer

    ../_images/qgis4.png
  4. Create a new connection clicking on New

    ../_images/qgis5.png
  5. Fill the information and test the connection

    ../_images/qgis6.png
    Name:

    city_routing

    Host:

    localhost

    Port:

    5432

    Database:

    city_routing

    User name:

    user

    Password:

    user

  6. Allow qgis to remember login and password

    ../_images/qgis7.png

1.2. Add a postGIS Layer

Click Connect and a list of tables and views from the database will show.

It is necessaary to select the column that has a distinct unique value:

  • seq on the routing views

  • gid on the data views

../_images/qgis8.png

1.3. Format a Routing Layer

  1. Choose a routing view, Right click ‣ Zoom to Layer

    ../_images/qgis9.png
  2. Right click ‣ Properties

    ../_images/qgis10.png
  3. Style ‣ Color

    ../_images/qgis11.png
  4. Style ‣ + ‣ Symbol Layer Type ‣ Marker line

    ../_images/qgis12.png
  5. Apply ‣ Close

1.4. Copy/Paste Format

  1. Choose a formmated layer and Right click ‣ Styles ‣ Copy Styles

    ../_images/qgis13.png
  2. Choose another layer and Right click ‣ Styles ‣ Paste Styles

    ../_images/qgis14.png

1.5. Save the project

  1. Project ‣ Save As …

    ../_images/qgis15.png
  2. Navigate to: User ‣ Desktop ‣ workshop and save pgrouting-Bucharest-Example

    ../_images/qgis16.png