Forum #22 - Topic #35 - Message List
Hi anton, In the demo http://demo.orkney.jp/ipax/, after calculate the shortestpath, I think you use a layer to show the route, right ? It means that, everytime you zoom or pan, you have to call that shortestPath layer again. The author of _How to show the route with Mapserver_ said that we can use temporary table, I know how to create temporary table, but I dont know how to use in this case. Can you give me some hints. (Or can you send me the ipax example :) !) Thanks !
-
Message #132
Hi,
I didn't make that demo, but you're right - it uses a layer to draw the path, but it stores the data somewhere at the client side (cookies?)
About temporary table. I thnk it should look like this:
1. Make a temporarty table executing something like SELECT * INTO tmp_table FROM shortest_path_function(bla-bla-bla);
2. When you zoom or pan, you need to select the data from temporary table.
3. When you want to calculate new path, you need to drop the table and execute the query from step 1.anton08/10/07 14:48:59 -
Message #133
Thanks for your response, About temporary table: To make temporary table, I think we have to use PHP first, right ? That means we have to establish a connection to PostgreSQL, but when you use postgis connection to show route, it will establish another connection to PostgreSQL, so this new connection won't 'see' the temporary table that was establish by PHP before. That's why I dont know how to use temporary table in this case. Do you have any ideas else ?
quang08/10/07 16:41:15 -
Message #134
Well, you can close first connection and open a new one, right? You know both your main table name and your temp table name. Or I just didn't catch your idea...
anton08/11/07 11:27:30 -
Message #135
My idea is, with 2 connections (same user) to postgreSQL, each connection can't see the temporary table created by the other.
The first connection is established by PHP (to create temporary table), the second connection is established by postgis (to show path layer _because we can't use postgis to create temporary table, right ?), that's why the postgis' connection can not query on temporary table created by PHP although you know table name.
You can test it by using 2 different program to connect to postgreSQL with the same user, for example phpPgAdmin and pgAdmin III, and you will got my idea.
quang08/11/07 12:46:27 -
Message #144
Instead of using temp tables, you can simply store the ID's of the vertices of the route in a cookie. If the routes aren“t made up of a lot of vertices, it won't be much slower than using temp tables. That'll save you a lot of hassle. I know that normally you can't store an array in a cookie, but there are several workarounds available for that.
jos08/15/07 00:02:26 -
Message #149
Hi jos, Thanks for your answer. I intended to do like you said, but now I found a new way to solve this problem. Instead of using layer with postgis connection to calculate and show the route, I use PHP/Mapscript to calculate the path, and then I store start and end coordinate and the result (WKT string) in session. So everytime user zoom or pan , I will get the WKT string in the session and use the Mapscript to display it as a feature of a layer again.
quang08/23/07 17:45:56

