How to setup a user/web account for use with DODS enabled MapServer
When applications linked against the DODS support library (DAP) they attempt to read a configuration file from ~/.dodsrc. To optimize performance of a MapServer based DODS application it is necessary for this file to be appropriate configured. A simple sample .dodsrc might look like this:
# DODS client configuation file. See the DODS # users guide for information. USE_CACHE=1 MAX_CACHE_SIZE=50 MAX_CACHED_OBJ=25 IGNORE_EXPIRES=0 CACHE_ROOT=/debian/home/warmerda/.dods_cache/ DEFAULT_EXPIRES=86400 ALWAYS_VALIDATE=0 # Request servers compress responses if possible? # 1 (yes) or 0 (false). DEFLATE=1 # Proxy configuration: # PROXY_SERVER=<protocol>,<host[:port]> # PROXY_SERVER=, # PROXY_FOR=<regex>,<host[:port]> # PROXY_FOR=, # NO_PROXY_FOR=<protocol>,<host|domain> # NO_PROXY_FOR=, AIS_DATABASE=/home/warmerda/dods/ogr_ais_eg.xml
Some key items to ensure are that USE_CACHE is set to 1, and that MAX_CACHE_SIZE is set reasonably large (it is measured in megabytes). Also that MAX_CACHED_OBJ is set reasonably high, 25 should be fine. These items are used to enable caching of http responses from DODS servers. Depending on configuration, the remote DODS server may still be asked to re-validate previous queries, but frequent re-transfer of the same data responses can be avoided.
It may also be helpful to set DEFLATE=1 so that remote servers can return results in compressed form, especially if the remote servers are non-local.
In order to ensure that mapserv also gets the same environment used during development, the CONFIG option in the mapfile can be used to instruct OGR what .dodsrc to use:
CONFIG DODS_CONFIG "/home/warmerda/.dodsrc"
Special issues with the web user are that the cache needs to be readable and writeable by MapServer. For instance, if httpd runs at "nobody", the home directory might be set to something unusual like / (see the /etc/passwd file). In this case a copy of the .dodsrc would need to be in /, and the .dods_cache would need to be somewhere that nobody can write. Perhaps below the directory already being used for temp web files for MapServer. The dods cache location can be controlled with the CACHE_ROOT variable in the .dodsrc.
Further information on the .dodsrc can be found in the [DODS/OPeNDAP Users Guide], particularly [Section A3].