[GIS] Why does Mapserver (ms4w) not generate tmp images

mapserveropenlayers-2

I am having trouble with my web-based application, where my tmp images are not being stored for later retrieval. The images are generated each time they have to be loaded, so zooming out and then back in to the same location requires mapserv.exe to re-generate the tiles for that view.

The application lives here: http://rinnerweb.arts.ryerson.ca/moot2

A sample map file snippet is below:

    OUTPUTFORMAT                                        #-> BEGIN OUTPUT FORMATTING DEFINITION
        NAME "png"                                      # Name of format
        DRIVER AGG/PNG                                  # Image driver
        MIMETYPE "image/png"                            # Type of image
        IMAGEMODE RGBA                                  # Image mode
        EXTENSION "png"                                 # Image filetype
        TRANSPARENT ON                                  # Transparency
    END                                                 #-> END OUTPUT FORMATTING DEFINITION

    WEB                                                 #-> BEGIN WEB DEFINITION
        IMAGEPATH "/ms4w/tmp/ms_tmp/"
        IMAGEURL "/ms_tmp/"
    END                                                 #-> END WEB DEFINITION

The web page's source will show the OpenLayers init code, but I've pasted some sample layer init code below:

hii_1 = new OpenLayers.Layer.MapServer("Land Cover","../../cgi-bin/mapserv.exe",{
    map:'C:/ms4w/Apache/htdocs/hii/hii_landcover.map'},{
    isBaseLayer:false,
    transparent:true,
    format:"image/png",
    alpha:true,
    displayInLayerSwitcher:false
    });

Any ideas?

Best Answer

The temp files are automatically deleted by MapServer. If you want to cache generated images you should look at something like TileCache, MapProxy, or the MapServer's new MapCache.

Update - after requiring this myself, it is possible to force MapServer to save the images to file on the server. You need to use the CGI parameter mode=browse. See http://mapserver.org/cgi/controls.html for all CGI parameters. The image will then be saved to IMAGEPATH.

Also make sure the MAP STATUS is set to ON.

Related Question