Mapfile creation including PostGIS layer with changing table (view) name?

Gregor Mosheh gregor at HOSTGIS.COM
Fri May 11 06:58:42 PDT 2007


Jan Peters-Anders wrote:
> Now my problem is, that I would need different mapfiles containing the
> different table (view) names to accomplish a correct display of the query
> results for each user.

Faced with a similar problem, of a sessionid defining which shapefiles I
wanted to use, I used PHP/Mapscript instead of "pure Mapserver" I did
something like the following, and a similar trick could definitely be done
with PostGIS even more easily.


LAYER
  NAME "gpstracks"
  DATA ""
  ...blah blah...
END

Then in PHP/Mapscript, something like:
$map->getLayerByName('gpstracks')->data = "$sessionid.shp";


Mapserver is good, but it isn't a programming language. Fortunately, it
includes Mapscript so you can use a real language to manipulate it.

-- 
HostGIS
Cartographic development and hosting services
707-822-9355
http://www.HostGIS.com/

"Remember that no one cares if you can back up, only if you can restore."
- AMANDA



More information about the MapServer-users mailing list