[OpenLayers-Users] PostgreSQL dynamic layer
Mario Basa
mario.basa at gmail.com
Fri Nov 10 11:28:53 EST 2006
Hello Adrian,
I am doing something similar with pgRouting. What I do is save the
resulting GIDs from the route request in a session, and then using
phpmapscript re-read the GIDs from the session and create a layer DATA
SQL string whenever there is a map request. The SQL will look
something like: "the_geom from (select * from road_network where gid
in (GIDS_FROM_SESSION))".
Although the TSP isn't working yet, you can take a look here for a
routing demo with Openlayers:
http://www.postlbs.org/postlbs-ol/
The site is in Japanese though.
Mario.
On 11/2/06, Moser Adrian <Adrian.Moser at bs.ch> wrote:
> Hi list,
>
> I already posted this question once but couldn't solve the problem.
> I'm implementing a routing application based on PostgreSQL/PostGIS. The routes are stored temporarily in a Postgres table together with the current session-ID. I then included this table in a Mapserver Layer which I want to show with OpenLayers. The problem is that could be different routes in the table and I just want to display the one belonging to the current session.
> There is a parameter expression that can be set in the .map file but I need to do this dynamically.
>
> Mapserver Layer:
>
> LAYER
> NAME path
> CONNECTIONTYPE POSTGIS
> CONNECTION "user=xxx password=xxx dbname=xxx host=localhost port=5432"
> DATA "the_geom from routingrouten"
>
> PROJECTION
> "init=epsg:4326"
> END
> STATUS ON
> TYPE LINE
>
> CLASS
> NAME 'path'
> STYLE
> COLOR 0 255 0
> WIDTH 3
> END
> END
> METADATA
> "wms_title" "path"
> END
> END
>
> JavaScript function:
>
> function showRoute(sessId) {
> //Berechente Route anzeigen
> wms_path = new OpenLayers.Layer.WMS("path",
> 'http://localhost/cgi-bin/mapserv.exe?map=c:/ms4w/Apache/htdocs/nafmomNeu/map/nafmom.map',
> {LAYERS: 'path', format: 'png', transparent: 'true'},{'buffer':1});
> map.addLayer(wms_path);
> }
>
> Is there a possibility to do this?
>
> I noticed that if I display a route (currently all routes are displayed) and the recalculate the route with slightly other start and end point an display it OpenLayers still shows the old route. It display to show a cached tile. How can I solve this problem?
>
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
More information about the Users
mailing list