You can request tiles from MapServer by a MapServer cgi request or by a WMS
request.
OpenLayers uses this
DEFAULT_PARAMS: {
mode: map,
map_imagetype: png // a 8bit png if not otherwise declared in the
mapfile
},
for OpenLayers.Layer.MapServer
DEFAULT_PARAMS: { service: WMS,
version: 1.1.1,
request: GetMap,
styles: ,
exceptions: application/vnd.ogc.se_inimage,
format: image/jpeg
},
for OpenLayers.Layer.WMS
if you not specify a imageformat, then the OpenLayers.Layer.MapServer
requests a png and the WMS requests a jpg (if not set transparent=true).
Arnd
_
Von: kensei3000 [mailto:kensei3...@yahoo.com]
Gesendet: Donnerstag, 30. Juni 2011 04:58
An: Arnd Wippermann
Cc: mapserver-users@lists.osgeo.org
Betreff: Re: AW: [mapserver-users] Low-resolution raster image problem
when usingOpenlayers
Hi Arnd,
I see. I used the same 'mapserv' url in both OpenLayers.Layer.WMS and
.MapServer code. The requests were sent to the same remote server. So the
difference must be in the requests. Is it possible that OpenLayers.Layer.WMS
generated a different output url string from the one generated by
OpenLayers.Layer.MapServer?
Ken
_
From: Arnd Wippermann arnd.wipperm...@web.de
To: 'kensei3000' kensei3...@yahoo.com
Cc: mapserver-users@lists.osgeo.org
Sent: Thursday, June 30, 2011 1:15 AM
Subject: AW: [mapserver-users] Low-resolution raster image problem when
usingOpenlayers
Hi Ken,
Quote : Interestingly, if I use the 'mapserv' executable directly in the
browser instead of using OpenLayers API, the image also renders correctly.
There could be no difference (OpenLayers.Layer.WMS or .MapServer), because
with OpenLayers you only create an url for an image tag (img src=url).
The response have to be the same as from the browser directly.
The difference could only be a result from different requests or the same
request to different servers.
Arnd
_
Von: kensei3000 [mailto:kensei3...@yahoo.com]
Gesendet: Mittwoch, 29. Juni 2011 09:56
An: Arnd Wippermann
Cc: us...@openlayers.org
Betreff: Re: AW: [mapserver-users] Low-resolution raster image problem
when usingOpenlayers
Hi Arnd,
I checked the images properties of the tile images using ImageMagick.
tile_topleft_remote.png has image type Palette (8-bit)
tile_topleft_local.png has image type TrueColor (32-bit)
The results I got seem to correlate with your findings.
Indeed, it appears that the image rendering between my local pc and the
server are different.
The map files are exactly same since I sync them in both computers.
The MapServer versions, however, are different. Here's what I got:
LOCAL:
MapServer version 6.0.0 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG SUPPORTS=PROJ
SUPPORTS=AGG SUPPORTS=CAIRO SUPPORTS=FREETYPE SUPPORTS=ICONV
SUPPORTS=FRIBIDI SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER
SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER SUPPORTS=SOS_SERVER SUPPORTS=FASTCGI
SUPPORTS=THREADS SUPPORTS=GEOS INPUT=POSTGIS INPUT=OGR INPUT=GDAL
INPUT=SHAPEFILE
REMOTE:
MapServer version 5.6.1 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP
OUTPUT=SWF OUTPUT=SVG SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE
SUPPORTS=ICONV SUPPORTS=FRIBIDI SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT
SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER SUPPORTS=FASTCGI
SUPPORTS=THREADS SUPPORTS=GEOS INPUT=EPPL7 INPUT=POSTGIS INPUT=OGR
INPUT=GDAL INPUT=SHAPEFILE
The MapServer executable in the remote server is an older version (5.6.1)
than the one in my pc (6.0.0). I edited the map files and images in my local
pc, then synced them to the server, so there may be an incompatibility. I
checked the Mapserver Migration Guide
(http://mapserver.org/de/MIGRATION_GUIDE.html) and my guess was that the
default OUTPUTFORMAT specifications of both versions could be different. I
did not specify an explicit OUTPUTFORMAT in my map file.
I created another test. This time I explicitly defined the OUTPUTFORMAT with
the following lines added to the map file in the remote server:
OUTPUTFORMAT
NAME jpeg
DRIVER AGG/JPEG
MIMETYPE image/jpeg
IMAGEMODE RGB
EXTENSION jpg
END
The result was that the output image generated by the remote server rendered
in TrueColor, similar to the output image in my local pc. Problem appears to
be fixed.
My guess right now is that the IMAGEMODE parameter above was somehow set to
PC256 (i.e. 8-bit color palette) by default.
Interestingly, if I use the 'mapserv' executable directly in the browser
instead of using OpenLayers API, the image also renders correctly.
EXAMPLE:
http://remotehost/cgi-bin/mapserv?map=/opt/maps/sandbox/mapserver_openlayers
_if/sample.mapmode=map
Above 'sample.map' did not have the OUTPUTFORMAT object explicitly defined.
In another test I ran using the original 'sample.map' (i.e. no OUTPUTFORMAT
object), I edited the