-
-
Notifications
You must be signed in to change notification settings - Fork 373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
trsp() doesnt find a route if Start_Edge = End_Edge #704
Comments
I can see that you are not using restrictions, then I strongly suggest that you use I have an answer here that looks like your problem where actually one "point" is actually a vertex on the topology (offset is 0 or 1) |
Hi again @cvvergara, if you remember my stackoverflow question from yesterday I have restrictions. I just remove it to make the sample easy to reproduce. Same thing regarding the offset I choose And again, my storeprocs are working fine in old version, the problem is now I have a different development enviroment and doesn't work as expected. |
Was it you whom asked this question? As I mentioned there, I can not be more of help on About the other functions (including this one): gradually, I've being enforcing what the documentation says about them. When 2.0 that was not done.To keep the old signatures for backwards compatibility, its done with wrappers. This has some comparison on the pgr_dijkstra signatures on 2.2 Some examples without turn restrictions from version 2.0 are the following: example: starting is same as destinationThis example shows shows that if you want to go from 1 to 1, that is you are already there so there is no need to have a path, this is what happens: the same data with 2.2 or higher example on undirected graph, from 2 to 3the expected path is 2->3 as its undirected, but this is what happens vs with 2.2 or higher My guess on why your storeprocs are not working wellpgr_dijkstra on v2.0 has the same problem as pgr_trsp, as well as many other functions (besides their own internal problems): the way internally they read & interpret the data. Now it catches user's contradictions:
its a contradiction: the FALSE indicates that the column reverse_cost is not to be used but has_rcost is FALSE, has_rcost mean has or use?,
If it means has, well there you are contradicted, you are saying it does not has it but you are providing it. so the intention is not to have it, so lets remove it so, which ever interpretation was (has or use), that contradiction is converted to the following:
As you can see FALSE indicates that you don't want to use the column reverse_cost, also means its not there, now there is no contradiction. to avoid that kind of problem the new signatures avoid that flag, so if its there is because you want to use it, if its not there is because you don't want to use it, also see there is no need of the type casting:
Gradually they are being fixed on the 2.x series. how to migrate from 2.0 to a higher versionmake sure all of your queries are not contradictory.
|
@cvvergara Yes, that is me :). Forgot here Im using my nick name instead of my real name. I really need restrictions. What you recomend:
What is that UI to test the function show in your pictures ? |
Please do not downgrade, the 2.x series main objective is to rewrite the functions because of old designs, bugs, etc. I'll rephrase: The original code hasn't changed. (except some function renames, and that the compiler was generating many warnings because of bad type handling) This are the calls to the original functions without the wrappers:
add an underscore to the function
answer to some of your questions:I used Qgis and the pgRoutingLayer plugin. back to pgr_trsp.
I other words, its doing magic, because on large scale it gives an answer, might not be perfect on unit tests, as you can see in the previous comment's images, but its better than nothing. Any improvement on C/C++ code, , improvement on the wrappers, your own design (even if its on plpgsql), improvement to the documentation is welcome. everything related to trsp is here: |
Sorry sometime I have problem undesrtanding the negatives in english. Which one do you suggest I use ?
|
Sorry, can not suggest anything. |
Option 2 should be the same as what you were getting with version 2.0.0. |
@woodbri I try it, but |
The file "sql/trsp_V2.2.sql" in the repository has the following two functions defined. The 2nd one is the trsp with with edged_id and fraction along the edge. You should see these in pgAdmin3 of via the psql command to view functions. Please make sure you have the correct arguments in the correct order.
|
@woodbri Weird I only have one signature. |
Then copy and paste the other signature into a sql window and run it. Then you should be able to try it out. |
@dropyghost Where do you get your pgrouting from? Do you compile it? Download it from somewhere? where? |
@woodbri I install with the stack Builder 3.1.1 |
@dropyghost |
I just checked the code for ver 2.2.0 and it has the following signatures:
The 2nd one does not have the leading '_', and it should be the same as in 2.0.0, but there may have been some changes to try and fix some issues that changed behavior. Regardless, trsp is targeted to be rewritten so it will not get much developer attention until that happens and then the old code will get removed. The original developer no longer supports the code and we are trying to refactor all the functions to reuse code and to given consistent results regardless of what function you are using. Sorry for the inconvenience, but these things take time and have to be worked in between other tasks. |
@cvvergara Sorry I dont know where to subscribe to get notification when new release appear. So that was the version available when I configure this PC and didnt change it since. Stack Builder is the app include in Postgres to allow you install plugins and other things, like postgis or pgAgent. |
@woodbri Is ok, I understand. But I think you are mistaken, because as I show in the test, the result are different. My guess is when change the function didnt think be necesary route between same link, because didnt take offset into consideration. But nevermind I patch it creating a case when the link is the same I create the Route myself.
|
yes, from 2.0 changes on the code were done because on 2.1 a developer added (on top of buggy code) the code for the pgr_trspViaEdges and pgr_trspViaVertex. And wrappers have being added since. |
@dropyghost OK, glad you have a work around solution that will work for you. |
@dropyghost If your old pgRouting version is 2.0.0 on Windows, |
@sanak Again sorry for my english. Do you mean:
The problem is after solve the Im about to create a new bug regarding this issue. |
@dropyghost
Okay, then some initialization parameter might be bad...
Okay, please. |
I made more test, and I might say that the behaviour is undefined when the point is actually a vertex
|
Note: |
Using the latest changes:
No restrictions:
With Restrictionsfrom the sample data
Then using the following query:
|
Work has been done for TRSP on develop branch for version 3.4 (due to be released on September/October 2022: For further similar problems with TRSP functions please open a new issue with the specific function name. |
I use it to my AVL app and sometimes the car doesnt move much or the link is too long, so stay in the same link.
Expected behavior and actual behavior
When try to calculate a route using pgr_trsp() and
start_edge = end_edge
In version "pgrouting-2.0.0" using offset return a single row with node -1 and the edge, the cost to travel is just between those offset. In this case I use offset

(0, 0.5)
In "pgrouting-2.2.2" doesnt return anything

Steps to reproduce the problem
If start_edge <> end_edge work ok in both versions.
Specifications like the version of pgRouting/PostGIS and PostgreSQL as well as Operating System
Have two postgres server:
This is my oldest server where was working ok.
Windows Server 2008 R2
"PostgreSQL 9.3.2, compiled by Visual C++ build 1600, 64-bit"
"POSTGIS="2.1.1 r12113" GEOS="3.4.2-CAPI-1.8.2 r3924" PROJ="Rel. 4.8.0, 6 March 2012" GDAL="GDAL 1.10.0, released 2013/04/24" LIBXML="2.7.8" LIBJSON="UNKNOWN" RASTER"
"(2.0.0,pgrouting-2.0.0,0,d6ed2cb,master,1.53.0)"
This is my newest install and doesnt work.
Windows 10
"PostgreSQL 9.5.3, compiled by Visual C++ build 1800, 64-bit"
"POSTGIS="2.2.2 r14797" GEOS="3.5.0-CAPI-1.9.0 r4090" PROJ="Rel. 4.9.1, 04 March 2015" GDAL="GDAL 2.0.2, released 2016/01/26" LIBXML="2.7.8" LIBJSON="0.12" RASTER"
"(2.2.2,pgrouting-2.2.2,544044b,master,1.59.0)"
The text was updated successfully, but these errors were encountered: