[OpenLayers-Users] PostgreSQL dynamic layer

Moser Adrian Adrian.Moser at bs.ch
Thu Nov 2 09:17:06 EST 2006


Hi,  That seems to be exactly what I'm searching for. I tried to transform my WMS layer to a Mapserver Layer but it doesnt' work. What do I need to change in the following layer definition that it works?  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);  Best regards, Adrian Moser -----Ursprüngliche Nachricht----- Von: david.bitner at gmail.com [mailto:david.bitner at gmail.com] Im Auftrag von David William Bitner Gesendet: Donnerstag, 2. November 2006 14:36 An: Moser Adrian Cc: users at openlayers.org Betreff: Re: [OpenLayers-Users] PostgreSQL dynamic layer You might want to try using the MapServer direct layer: http://openlayers.org/dev/examples/mapserver.html Then set up your data string in your mapfile to use variable substitution to contain your session id  (read the mapserver manual for variable sub and for the postgis data statement syntax as this is coming from my head) so your data string would be something like DATA "the_geom from (select * from my table where mysessionid=%SESSIONID%) as foo using unique oid using srid 4326"  Then in openlayers you would add a parameter to your layer string:{layers:'mylayer',sessionid:'234255464564'} You could then use MergeNewParams (see http://openlayers.org/dev/examples/wmst.html for example) to change your sessionid as you add new routes to the table. As I said, take this as a general road map and check the docs, I can guarantee I butchered some syntax,  bitner 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: LAYERNAME pathCONNECTIONTYPE POSTGISCONNECTION "user=xxx password=xxx dbname=xxx host=localhost port=5432" DATA "the_geom from routingrouten"PROJECTION"init=epsg:4326"ENDSTATUS ONTYPE LINECLASSNAME 'path'STYLE COLOR 0 255 0WIDTH 3ENDENDMETADATA"wms_title" "path"END END JavaScript function: function showRoute(sessId) { //Berechente Route anzeigenwms_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  --  ************************************ David William Bitner 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20061102/f85af81b/attachment.html


More information about the Users mailing list