Table of Contents
FAQ: Tips and tricks
Default layers visible on map but not in legend/TOC
If a layer should always be visible on the map but not selectable/visible in legend or TOC (e.g. copyright, north arrow, background image layer) the easiest solution is to define for the layer in the map file
STATUS DEFAULT
and don't reference the layer in the config.ini file. This way it is always drawn by Mapserver logic and never switched off by p.mapper logic.
Optimization image output format:
Why when a vector layer is selected the output png image size is about 30kb and if a raster is selected the output png image size is about 500kb. The same example in jpeg output size is about 120kb in all case but quality is less than png.
JPEG generally is better for raster layer but you could have eg. scanned black/white maps that are also raster layers but are smaller when in PNG and look better than in JPEG. Also thematic raster layers (like DEM/slopes, landuse raster data) using CLASS definitions in Mapserver are normally better displayed in PNG than JPEG.
Remove temporary files from /tmp directory
p.mapper creates various temporary files under the directory specified in the map file at WEB - IMAGEPATH
to remove them automatically add a shell script file rm_tempfiles under /etc/cron.daily that contains the following lines:
#!/bin/sh
find /home/www/tmp -name "*.png" -amin +60 -exec rm -f {} \;
find /home/www/tmp -name "*.jp*" -amin +60 -exec rm -f {} \;
find /home/www/tmp -name "*.tif" -amin +60 -exec rm -f {} \;
find /home/www/tmp -name "*.zip" -amin +300 -exec rm -f {} \;
find /home/www/tmp -name "*.tar" -amin +300 -exec rm -f {} \;
find /home/www/tmp -name "*.tmp" -amin +300 -exec rm -f {} \;
find /home/www/tmp -name "*.pdf" -amin +300 -exec rm -f {} \;
find /home/www/tmp -name "*.xls" -amin +300 -exec rm -f {} \;
find /home/www/tmp -name "sess_*" -amin +300 -exec rm -f {} \;
and set the file executable
~# chmod 755 rm_tempfiles
Setting up a common library container for multiple p.mapper applications
p.mapper currently requires to have all PHP and Javascript files inside the main application window. For multiple applications using the same PHP and JS code base this requires a multiple maintenance of these files. Most p.mapper applications differ just in the configuration (config.ini, map file, etc) and the CSS templates, so having them sharing the same libaries makes the maintenance of these applications easier, mainly for applying updates and bug fixes.
One way to work with this is the use of symbolic links. One could e.g. set up in the WWW root a common directory pmapper containing the javascript and incphp directories and symlinking them into the applications' tree. Like the following example
+ pmapper
+ incphp
+ javascript
+ application_1
+ incphp->../pmapper/incphp
+ javascript->../pmapper/javascript
+ application_2
+ incphp->../pmapper/incphp
+ javascript->../pmapper/javascript
While working with symlinks is something typical under UNIX, Windows does not seem to provide this functionality. But in fact, it does, just not well documented. See eg. this article how to work with 'junctions', the equivalent of symlinks under Windows.
