[OpenLayers-Users] PostgreSQL dynamic layer

Moser Adrian Adrian.Moser at bs.ch
Thu Nov 2 07:33:32 EST 2006


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?





More information about the Users mailing list