[pgrouting-users] pgrouting serverscript produces multiple ways but many wrong.

Yaron Lev yaron666 at gmail.com
Fri Oct 25 11:42:14 PDT 2013

This is my best guess to whats happening in your app. (no guarantee)

you are taking the response from pgrouting, but not editing it.

the response from the pg-routing algo (the sql query), will have edge_id,
then you take those and join them with the original table, to produce geom
for each edge.

the problem is that many edges contains info about a two way. thus those
edges can be viewed like they are in the table i.e (X1,X2...Xn), which is
whats happening in your case,

and if we want the other way (Xn,Xn-1...x1), we need to flip it, (reverse
the order)

when you ask for a route, the return edges geom might be reversed to what
you need in your route. thus you need to flip some of them (where you were
ment to travel in the opposite way of the way geom), if the order of the
points is important.

i am going to assume that when you plot the route, you are using one big
line string to describe the route, this means the order of the point is
important (because right now some of them are reversed, if you would draw a
line between each of them, you will get your picture)

you fix by checking the first edge, and deciding if its correct, from there
just match it to the previous (by comparing source ,target,x1,y1,x2,y2),
or drawing each edge by itself with a loop.

hope it helps.

On Fri, Oct 25, 2013 at 5:49 PM, Stephen Woodbridge <woodbri at swoodbridge.com
> wrote:

> On 10/19/2013 2:02 PM, Hishan Melanga wrote:
>> Hi everyone,
>> Currently I am trying to interface pgrouting with OSMDroidBonus pack.
>> I am using the older pgrouting library 1.5.
>> I modified the older phpserverscript to produce geoJSON output. Server
>> script can be found in the following link.
>> https://www.dropbox.com/s/**la3ettzc30wk8ne/**congestRouting.php<https://www.dropbox.com/s/la3ettzc30wk8ne/congestRouting.php>
>> The problem is the script produces several paths including the correct
>> path.
>> Inline image 1
>> I do not understand why my server script is producing wrong
>> geo-coordinates as well. Please help me.
>> Thanks in advance.
> Hi Hishan,
> You have a lot of pieces to this puzzle like:
> 1. where is the input coming from? Where is it getting passed to? is it
> getting passed correctly?
> 2. what is the SQL query that is getting generated?
> 3. If you plug the SQL into psql or pgadmin is it generating the correct
> (or expected) results?
> 4. If not, is the problem with pgrouting or the data you loaded?
> 5. are the results from the SQL (right or wrong) getting passed back to
> you application correctly? ie: is the out output of the SQL the SAME as
> what your application is getting?
> 6. Is the application displaying the results correctly? How do you know?
> To debug the PHP you can write messages to stderr and they should show up
> in the apache error.log file.
> I think you have a some work to debug your application and locate where in
> all of this something is going wrong and what is going wrong. If it is in
> pgRouting, then maybe you can post a small test that we can run in pgadmin
> or psql.
> Also, we are not doing anything to support or fix bugs in 1.x series
> unless it is funded. I strongly recommend that you upgrade to pgRouting 2.0
> Best regards,
>   -Steve
> ______________________________**_________________
> Pgrouting-users mailing list
> Pgrouting-users at lists.osgeo.**org <Pgrouting-users at lists.osgeo.org>
> http://lists.osgeo.org/**mailman/listinfo/pgrouting-**users<http://lists.osgeo.org/mailman/listinfo/pgrouting-users>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/pgrouting-users/attachments/20131025/4c97e810/attachment.html>

More information about the Pgrouting-users mailing list