[mapserver-users] The browser can't display the rendered image

Attila Borbás attila.borbas at gmail.com
Wed Nov 19 12:22:51 PST 2008


Hello,

I still have got a problem. I ve tested my mapfiles (with quickmap.php) and
they work fine, but the problem is the same. My php/mapscript code created
the map image and saved it to "/ms_tmp/" but the browser couldn't display it
(I got a broken img). I enclose the php/mapscript file, the mapfile and the
page source.Thx for ur help and patience.

PHP/MAPSCRIPT FILE:

<?php
define( "MAPFILE", "/ms4w/apps/raster/raster.map" );
define( "MODULE", "php_mapscript.dll" );
if(!extension_loaded("mapscript")) dl(MODULE);
$oMap = ms_newMapObj( MAPFILE );
//draw
$oImage = $oMap->draw();
//output map
$url = $oImage->saveWebImage();
?>
<HTML>
   <HEAD>
      <TITLE>Example 1: Displaying a map</TITLE>
  </HEAD>
  <BODY>
      <IMG SRC="<?php echo $url; ?>">
  </BODY>
</HTML>

MAPFILE (I created it with qgis):

MAP
  NAME world_raster
  SIZE 600 600
  UNITS dd

  EXTENT -188.678212 -114.270312 189.321981 107.893344
  PROJECTION
    'proj=longlat'
    'ellps=WGS84'
    'datum=WGS84'
    'no_defs'
    ''
  END

  IMAGECOLOR 192 192 192
  IMAGEQUALITY 95
  IMAGETYPE jpeg
  OUTPUTFORMAT
    NAME jpeg
    DRIVER 'GD/JPEG'
    MIMETYPE 'image/jpeg'
    #IMAGEMODE PC256
    EXTENSION 'jpeg'
  END
  LEGEND
      IMAGECOLOR 255 255 255
    STATUS ON
    KEYSIZE 18 12
    LABEL
      TYPE BITMAP
      SIZE MEDIUM
      COLOR 0 0 89
    END
  END


  WEB

    IMAGEPATH '/ms4w/tmp/ms_tmp/'
    IMAGEURL '/tmp/ms_tmp/'

    METADATA
      'wms_title'           'world_raster'
      'wms_onlineresource'  'http://my.host.com/cgi-bin/mapserv?map=wms.map&
'
      'wms_srs'             'EPSG:4326'
    END

  END

  LAYER
    NAME 'world_raster'
    TYPE RASTER
    DATA '/ms4w/Apache/htdocs/world_raster.tif'
    METADATA
      'wms_title' 'world_raster'
    END
    STATUS DEFAULT
    TRANSPARENCY 100
    PROJECTION
    'proj=longlat'
    'ellps=WGS84'
    'datum=WGS84'
    'no_defs'
    ''
    END
  END

END

Page source (after I ran the code the html part saw the link to the image
but didn't display it.):

<HTML>
<HEAD>
<TITLE>Example 1: Displaying a map</TITLE>
</HEAD>
<BODY>
<IMG SRC="c:/ms4w/tmp/ms_tmp/4923f091_c84_0.jpeg">
</BODY>
</HTML>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20081119/31ca1073/attachment.htm>


More information about the MapServer-users mailing list