[pgrouting-users] PgRouting-Problems with own OSM-data

Kai Behncke Kai-Behncke at gmx.de
Wed Apr 15 12:40:54 EDT 2009


Dear Stephen, Dear Users,

first of all thank you for answering and sorry, that I reply so late.


> 
> This problem may be because the start and stop point are almost vertical 
> and the code uses these two points to construct a bounding box to select 
> street segments from to run the analysis. It adds a buffer to the bbox 
> but it might not be enough to capture all the segments need for a 
> solution. You can change the buffer size in pgpsql code. ou might want 
> to use and algorithm like if the bbox is nearly horizontal or vertical 
> then make is square based on the larger dimension. This is have a small 
> performance penalty but you will get less failures.

I think the street segments are find correctly.
In the picture

http://www.selbstverwaltung-bundesweit.de/routingfrage_1.png (screenshot 1)

 you can see the start and the endpoint
(the red square is the box within is looked for overlapping geometries).

Definetely the first requests for the start and finalpoint work fine
(    $sql = "SELECT gid, source, target, the_geom,
               distance(the_geom, GeometryFromText(
                 'POINT(".$lonlat[0]." ".$lonlat[1].")', 900913)) AS dist
           FROM ".TABLE."  
           WHERE the_geom && setsrid(
                 'BOX3D(".($lonlat[0]-200)."
                        ".($lonlat[1]-200).",
                        ".($lonlat[0]+200)."
                        ".($lonlat[1]+200).")'::box3d, 900913)
           ORDER BY dist LIMIT 1"

I get results ands they seem to be correct
(you can see in the screenshot the red stars symbolize the nodes of the two
roads (OSM-Data)
(the blue, little stars are the nodes of the other OSM-roads/ways/etc.).

but then the problem comes  if I use the Dijkstra-SQL:

   case 'SPD' : // Shortest Path Dijkstra
     $sql = "SELECT rt.gid, AsText(rt.the_geom) AS wkt,
                  length(rt.the_geom) AS length, ".TABLE.".id
               FROM ".TABLE.",
                   (SELECT gid, the_geom
                       FROM dijkstra_sp_delta(
                           '".TABLE."',
                           ".$startEdge['source'].",
                           ".$endEdge['target'].",
                           3000)
                    ) as rt
               WHERE ".TABLE.".gid=rt.gid;";

(Of course it is filled with values)...but it gives no result, but I don`t understand why????


I tested it with the victoria-data and the same code.

It doens`t seem as if the topology has more nodes as you can see in screenshot 2:

http://www.selbstverwaltung-bundesweit.de/routing_geht.png



The geom is correctly recognized and with:

SELECT rt.gid, AsText(rt.the_geom) AS wkt,

                  length(rt.the_geom) AS length, routing_victoria.id

               FROM routing_victoria,

                   (SELECT gid, the_geom

                       FROM dijkstra_sp_delta(

                           'routing_victoria',

                           1089,

                           1369,

                           3000)

                    ) as rt

               WHERE routing_victoria.gid=rt.gid;

I get correctly that:

http://www.selbstverwaltung-bundesweit.de/datenbank.png


Can anybody please explain what happens in the above mentioned function please?
What could be the difference between the victoria-data and my osm-data?



> > Problem 2:
> > 
> > 
> > If I get a result it`s mostly wrong, as you can see here:
> > 
> > 
> > Screenshot 2:
> > http://www.selbstverwaltung-bundesweit.de/too_long.png
> > 
> > The route is far too long.
> > 
> > How can this be?
> 
> This might depend on which analysis you requested. The shooting star 
> evaluates based on edges and I do not think it trims the edges. Where 
> the dijkstra's evaluates nodes and adds the start and stop node. I had 
> to modify the code to trim segments, unfortunately those changes are 
> mixed in with a bunch of other changes that I made and not easy to
> extract.

Hmmm.....I just use the dijkstra


SELECT rt.gid, AsText(rt.the_geom) AS wkt,
length(rt.the_geom) AS length, routing_victoria.id
 FROM routing_victoria,
(SELECT gid, the_geom
FROM dijkstra_sp_delta(
'routing_victoria',
1089,
1369,
3000)) as rt
WHERE routing_victoria.gid=rt.gid;

The start and stop node are set, but the result (if I at least get one) very weird....
I think it MUST be a data-problem......
But in the moment I have no idea how to fix it :-(

Beste regards, Kai


-- 
Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate + Telefonanschluss für nur 17,95 Euro/mtl.!* http://dslspecial.gmx.de/freedsl-surfflat/?ac=OM.AD.PD003K11308T4569a



More information about the Pgrouting-users mailing list