[pgrouting-users] Problem with dijkstra_sp:

Hi All,

I would appreciate a lot your help if you could suggest how to fix this: “dijkstra_sp” function seems not to work :-s.

I excuse in advance: my knowledge of db and gis systems is very little and you will have to provide a “pgrouting for dummies” explanation J

I am working with win32, postgresql 8.4, pgadmin 1.10.5, postgis 1.5, pgrouting 1.03.

I processed my shp file in Openjump first (I made the edge file planar and calculated the length of the edges) and then imported it in postgresql by using this plugin for pgadmin: http://www.roxor.it/guide/13-guide-gis/13-guida-importare-shape-postgres-postgis.html.

I have imported all the pgrouting functions by following these steps: http://hi.baidu.com/%C5%A3%B5%C3%CC%EC%CF%C2/blog/item/beabb7b4512c35c037d3ca03.html (step 2).

I have currently all the postgis and pgrouting functions loaded, a table with the “the_geom”, “gid”, “source”, “target”, “length” fields, as described in the link above and a table that will contain the results of dijkstra (steps 5, 6,7,8).

I get stuck when I call the “dijkstra_sp” function (step 8)… the error msg is:

ERROR: source contains a null value

CONTEXT: PL/pgSQL function “dijkstra_sp” line 12 at cycle FOR in an instruction EXECUTE

Any idea about what went wrong?

Thanks a lot!

Maria

ERROR: source contains a null value

CONTEXT: PL/pgSQL function “dijkstra_sp” line 12 at cycle FOR in an instruction EXECUTE

Can you inspect your data and check that there is no empty “source” attribute?

Daniel

Any idea about what went wrong?

Thanks a lot!

Maria


Pgrouting-users mailing list
Pgrouting-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/pgrouting-users


Georepublic UG & Georepublic Japan
eMail: daniel.kastl@georepublic.de
Web: http://georepublic.de

Wow Daniel ! This was so fast and at the point!

Source and target attributes are empty. Should I fill them? With what?

Thanks a lot!

Maria

Da: pgrouting-users-bounces@lists.osgeo.org [mailto:pgrouting-users-bounces@lists.osgeo.org] Per conto di Daniel Kastl
Inviato: mercoledì 27 aprile 2011 11.46
A: pgRouting users mailing list
Oggetto: Re: [pgrouting-users] Problem with dijkstra_sp:

ERROR: source contains a null value

CONTEXT: PL/pgSQL function “dijkstra_sp” line 12 at cycle FOR in an instruction EXECUTE

Can you inspect your data and check that there is no empty “source” attribute?

Daniel

Any idea about what went wrong?

Thanks a lot!

Maria


Pgrouting-users mailing list
Pgrouting-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/pgrouting-users


Georepublic UG & Georepublic Japan
eMail: daniel.kastl@georepublic.de
Web: http://georepublic.de

2011/4/27 Maria Battarra <maria.battarra@gmail.com>

Wow Daniel ! This was so fast and at the point!

Source and target attributes are empty. Should I fill them? With what?

Like this: http://workshop.pgrouting.org/chapters/topology.html#calculate-topology

Daniel

Thanks a lot!

Maria

Da: pgrouting-users-bounces@lists.osgeo.org [mailto:pgrouting-users-bounces@lists.osgeo.org] Per conto di Daniel Kastl
Inviato: mercoledì 27 aprile 2011 11.46
A: pgRouting users mailing list
Oggetto: Re: [pgrouting-users] Problem with dijkstra_sp:

ERROR: source contains a null value

CONTEXT: PL/pgSQL function “dijkstra_sp” line 12 at cycle FOR in an instruction EXECUTE

Can you inspect your data and check that there is no empty “source” attribute?

Daniel

Any idea about what went wrong?

Thanks a lot!

Maria


Pgrouting-users mailing list
Pgrouting-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/pgrouting-users


Georepublic UG & Georepublic Japan
eMail: daniel.kastl@georepublic.de
Web: http://georepublic.de


Pgrouting-users mailing list
Pgrouting-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/pgrouting-users


Georepublic UG & Georepublic Japan
eMail: daniel.kastl@georepublic.de
Web: http://georepublic.de

Great! After playing a little… I made it work J Many thanks…

Next I need to figure out:

  1. How to compute the distance associated to the shortest path (is it ok if I define in the table dijsktra_result a new column “length” and I use the function “UPDATE edges SET length = length(the_geom);”?)

  2. Visualize the indexes of the origin and destinations in the map (so as I can compute shortest paths from known origins and destinations)

  3. Arrange everything in a two “for cycles” so to come out with an origin destination matrix…

I hope I will manage…Suggestions?

Thanks a lot, you really helped me a lot!

Maria

2011/4/27 Maria Battarra <maria.battarra@gmail.com>

Great! After playing a little… I made it work J Many thanks…

Next I need to figure out:

  1. How to compute the distance associated to the shortest path (is it ok if I define in the table dijsktra_result a new column “length” and I use the function “UPDATE edges SET length = length(the_geom);”?)

  2. Visualize the indexes of the origin and destinations in the map (so as I can compute shortest paths from known origins and destinations)

  3. Arrange everything in a two “for cycles” so to come out with an origin destination matrix…

Maybe you want to look at the workshop once: http://workshop.pgrouting.org
It will answer the most common questions.

If you need a distance matrix, you could try APSP (All-pair-shortest-path) algorithm, that Jay developed a few weeks ago. It’s currently in the pgRouting fork of his Github account. But you probably better don’t try this on Windows, because compiling pgRouting on Windows isn’t trivial task.

Daniel

I hope I will manage…Suggestions?

Thanks a lot, you really helped me a lot!

Maria


Pgrouting-users mailing list
Pgrouting-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/pgrouting-users


Georepublic UG & Georepublic Japan
eMail: daniel.kastl@georepublic.de
Web: http://georepublic.de