Hi Lisa,

I have had problems like this before.  Here is what I did:

- added ob_clean() near end of my PHP scripts to flush out buffer
- saved temp image with rand() in filename, such as:
        $file = $oImage->save("ttt".rand().".png", $oMap);

I know it's not fancy, but it has worked for me.

-jeff


--
Jeff McKenna
MapServer Consulting and Training Services
https://gatewaygeomatics.com/



On 2019-01-22 7:03 PM, lisa wrote:
Hello - I have been trying to solve an this issue for about a week now and I
am hoping someone can give me some ideas on how to solve it.
Here is the setup:
Centos 6
Apache 2.2.15
PHP 5.3.3
Mapserver 6.4.3

I have an old website that serves up weather related data. A crontab process
downloads radar images from the national weather service and saves a sliding
window of 3 hrs worth of them them as gifs (ex: n0r_t_m000.gif for the most
current radar image). These gifs are defined as data sources for layers in a
.map file like this:
LAYER
    NAME 'Radar_000'
    TYPE RASTER
    STATUS ON
    DATA ../../../cache/radar/n0r/n0r_t_m000.gif
    OFFSITE 255 255 255
  END

A php script reads this map file and changes it, to turn on the layers it
wants to display:
$map = ms_newMapObj("../../mapserver/radar/radar.map");
$radar_layer = $map->getLayerByName("Radar_000");
$radar_layer->set("status", MS_ON);

It uses mapObj draw() to create an imageObj and then saveWebImage() to store
that image in a temp file, like this:
$image = $map->draw();
$image_name = $image->saveWebImage();

The problem is that the temp file that is created IS NOT ALWAYS the correct
image, as specified as the source data for that layer. It is sometimes an
older version of the gif. I have double and triple checked that the source
data is correct. I also printed out the map file, from the mapObj in the php
script and used shp2img to generate an image, and that image IS ALWAYS
CORRECT. I have also turned on Mapserver level 5 debugging, and CPL_DEBUG,
but that did not help either.

Does anyone know what might be causing this or where else I can look to
debug the problem?
I can provide more info if needed.

Thanks very much!  - lisa


_______________________________________________
mapserver-users mailing list
mapserver-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users

Reply via email to