0

This question already has an answer here:

I have been working on a project for indoor navigation.

I made the floorplan of the building and road-map for routing purposes as shp files (using JOSM, making GeoJSON and then converting to shp file using http://www.mapshaper.org/)

Then using POST GIS ShapeFile Loader (of pgAdmin III) I imported road-map(route.shp) to the database.

In QGIS, i was able to use the shortest path plugin to do the routing screen shot of my project, red color indicates the route

//////////////////////////////////////////////////////////////////////////////////////////

EDITED

////////////////////////////////////////////////////////////////////////////////////////// The following are screen shots of route ROUTE IN QGIS DB MANAGER contents of ROUTE prev

The following are screen shots of route_vertices_pgr enter image description here enter image description here enter image description here

When I tried to use the pgrouting plugin of QGIS , I got the below error error

What am I doing wrong?

marked as duplicate by underdark Mar 8 '14 at 20:45

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Just to clarify: Did you install pgRouting in testgis database? – underdark Mar 2 '14 at 20:03
  • Please check if the geometry column is called "geom" or "the_geom" and what you used in the plugin. – underdark Mar 2 '14 at 20:06
  • I installed pgRouting using the Plugin Manager of Qgis. I didn't have to select any database during installation. Geometry column in route is 'geom'. Geometry column in topology created is 'the_geom'. I tried both. – 0aslam0 Mar 4 '14 at 1:23
  • Did you install pgrouting for PostGIS? Please note that this has nothing to do with what you did or did not install in QGIS. – underdark Mar 4 '14 at 19:36
  • @underdark YES...given below is my output in psql: azx=# select pgr_version(); pgr_version ------------------------------------------------- (2.0.0,pgrouting-2.0.0,0,d6ed2cb,master,1.53.0) (1 row) – 0aslam0 Mar 6 '14 at 15:51
1

If you want to get the geometry values from input latitude/longitude coordinates via SQL, please see the following section of pgRouting Workshop contents.

[8. Writing a pl/pgsql Wrapper]
http://workshop.pgrouting.org/chapters/wrapper.html

I want to pass the latitude and longitude of the source and target as i did in the shortest path plugin of QGIS.

The output i need is the geom value of the route obtained. Any help?

  • I was going through the code of the function (section 8.4 - Route between lat/lon points and return ordered geometry with heading) and i found that SRID is being passed as a parameter. When i loaded the map to database , i set the SRID to be 111 (a random value). So what value should i give here? How important is SRID? – 0aslam0 Feb 24 '14 at 6:31
  • Judging from your attached image, I think that any SRID is okay. (4326 .etc) – sanak Feb 25 '14 at 11:19
0

If you want to use pgRouting from within QGIS, you should use the pgRoutingLayer plugin from https://plugins.qgis.org/plugins/pgRoutingLayer/

  • Ok. I installed it. I don't have an edge_table for my route.shp How can i generate one? Also I get a python error when i try to give source_id or target_id. Honestly, I don't know what they are. Is it the same as gid? – 0aslam0 Feb 20 '14 at 12:34
  • 1
    Could you specify edge_table:route, geometry:geom, id:gid, then select source_id/target_id from green [+] button, and click [Run] button? – sanak Feb 21 '14 at 5:20
  • @sanak , i ..tried that . I get a python error – 0aslam0 Feb 24 '14 at 6:19
  • 1
    @xachu4u I reproduced the error by stopping selected database. (Could you check whether database("testqgis"?) is alive?) – sanak Mar 2 '14 at 12:36
  • 1
    I have found the mistake i have been making. When i added the database in Qgis, i did not save the username and password, so there was always a connection failure. – 0aslam0 Mar 10 '14 at 18:38

Not the answer you're looking for? Browse other questions tagged or ask your own question.