[mapserver-users] getting corrupted png with WMS request to mapserv CGI on command line

thomas bonfort thomas.bonfort at gmail.com
Wed May 27 03:12:02 PDT 2015


IMAGEPATH /tmp/ should be changed to
IMAGEPATH "/tmp/"

--
thomas

On 27 May 2015 at 11:47, Renzo Kottmann <rkottman at mpi-bremen.de> wrote:
> Hi All,
>
> I have installed mapserver 6.4.1 in a docker container based on debian
> jessie (see dockerfile below)
>
> If I run:
>
> /usr/lib/cgi-bin/mapserv -nh
> "QUERY_STRING=EXCEPTIONS=application/vnd.ogc.se_inimage&REQUEST=GetMap&SERVICE=WMS&VERSION=1.1.1&map=/genes-mapserver/wms_test.map&SRS=EPSG:4326&BBOX=-180,-90,180,90&FORMAT=image/png&WIDTH=1080&HEIGHT=614&STYLES=&LAYERS=satellite_mod"
>> /tmp/test.png
>
> The png is corrupt and I can not open it with neither gimp nor firefox.
>
>
> However, I get valid pngs using the very same map file with shp2img or
> mapserv -nh
> "QUERY_STRING=map=/genes-mapserver/wms_test.map&mode=map&layers=satellite_mod
> .
>
>
> Find below more details (mapserver version, exact command lines I used and
> resulting debug logs, map file, and docker file)
>
>
> I searched google, the mailing list archives, but nothing seems to be
> similar to this problem. Therefore, any help is very much appreciated :)
>
> ciao,
> renzo
>
>
> * Mapserver Version:
>
> MapServer version 6.4.1 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=KML
> SUPPORTS=PROJ SUPPORTS=GD SUPPORTS=AGG SUPPORTS=FREETYPE
> SUPPORTS=CAIRO SUPPORTS=SVG_SYMBOLS SUPPORTS=RSVG 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=JPEG INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE
>
>
> * Command lines
>
> Generates valid png:
>
> /usr/lib/cgi-bin/mapserv -nh
> "QUERY_STRING=map=/genes-mapserver/wms_test.map&mode=map&layers=satellite_mod"
>> /tmp/test.png
>
> shp2img --all_debug 2 -m /genes-mapserver/wms_test.map -o /tmp/test.png
>
>
> Generates invalid corrupt png:
>
> /usr/lib/cgi-bin/mapserv -nh
> "QUERY_STRING=EXCEPTIONS=application/vnd.ogc.se_inimage&REQUEST=GetMap&SERVICE=WMS&VERSION=1.1.1&map=/genes-mapserver/wms_test.map&SRS=EPSG:4326&BBOX=-180,-90,180,90&FORMAT=image/png&WIDTH=1080&HEIGHT=614&STYLES=&LAYERS=satellite_mod"
>> /tmp/test.png
>
>
>
> * Log file (for all three runs in that order):
>
>
> [Wed May 27 08:51:44 2015].475696 CGI Request 1 on process 79
> [Wed May 27 08:51:44 2015].476881 msDrawMap(): rendering using outputformat
> named png (AGG/PNG).
> [Wed May 27 08:51:44 2015].476916 msDrawMap(): WMS/WFS set-up and query,
> 0.000s
> [Wed May 27 08:51:44 2015].478222 msDrawRasterLayerLow(satellite_mod):
> entering.
> [Wed May 27 08:51:45 2015].16608 msDrawMap(): Layer 0 (satellite_mod),
> 0.540s
> [Wed May 27 08:51:45 2015].16665 msDrawMap(): Drawing Label Cache, 0.000s
> [Wed May 27 08:51:45 2015].16677 msDrawMap() total time: 0.541s
> [Wed May 27 08:51:45 2015].38545 msSaveImage(stdout) total time: 0.022s
> [Wed May 27 08:51:45 2015].38838 mapserv request processing time (msLoadMap
> not incl.): 0.563s
>
> [Wed May 27 08:56:29 2015].752703 msDrawMap(): rendering using outputformat
> named png (AGG/PNG).
> [Wed May 27 08:56:29 2015].752820 msDrawMap(): WMS/WFS set-up and query,
> 0.000s
> [Wed May 27 08:56:29 2015].754465 msDrawRasterLayerLow(satellite_mod):
> entering.
> [Wed May 27 08:56:30 2015].295590 msDrawMap(): Layer 0 (satellite_mod),
> 0.543s
> [Wed May 27 08:56:30 2015].295664 msDrawMap(): Drawing Label Cache, 0.000s
> [Wed May 27 08:56:30 2015].295684 msDrawMap() total time: 0.544s
> [Wed May 27 08:56:30 2015].323794 msSaveImage(/tmp/test.png) total time:
> 0.028s
>
> [Wed May 27 08:59:28 2015].995397 CGI Request 1 on process 82
> [Wed May 27 08:59:28 2015].995464 msWMSLoadGetMapParams(): enabling
> non-square pixels.
> [Wed May 27 08:59:28 2015].996733 msDrawMap(): kicking into non-square
> pixel preserving mode.
> [Wed May 27 08:59:28 2015].997595 msDrawMap(): rendering using outputformat
> named png (AGG/PNG).
> [Wed May 27 08:59:28 2015].997614 msDrawMap(): WMS/WFS set-up and query,
> 0.000s
> [Wed May 27 08:59:28 2015].998950 msDrawRasterLayerLow(satellite_mod):
> entering.
> [Wed May 27 08:59:29 2015].651061 msDrawMap(): Layer 0 (satellite_mod),
> 0.653s
> [Wed May 27 08:59:29 2015].651143 msDrawMap(): Drawing Label Cache, 0.000s
> [Wed May 27 08:59:29 2015].651167 msDrawMap() total time: 0.656s
> [Wed May 27 08:59:29 2015].681373 msSaveImage(stdout) total time: 0.030s
> [Wed May 27 08:59:29 2015].681769 mapserv request processing time
> (msLoadMap not incl.): 0.686s
>
>
> * map file
>
>
> MAP
> NAME "wms_test"
> STATUS ON
> EXTENT -180 -90 180 90
> IMAGECOLOR 210 210 210
> IMAGETYPE png
> SIZE 1080 614
> UNITS dd
>
> CONFIG "MS_ERRORFILE" "/tmp/wms_test_error.txt"
> DEBUG 2
>
>
> PROJECTION
> #this is WGS84
> "init=epsg:4326"
> END
>
>
> SYMBOLSET "etc/symbols.sym"
> FONTSET "etc/fonts/fonts.txt"
>
> WEB
> IMAGEPATH /tmp/
> IMAGEURL "/tmp/"
>
> ERROR "/error.html"
> EMPTY "/no_result.html"
>
>
> METADATA
> ### Enable WFS support
> "wms_title"           "wms test"
> "wms_onlineresource"  "http://localhost/wms?"
> "wms_srs"             "EPSG:4326"
> "wms_enable_request"  "GetCapabilities GetMap GetFeatureInfo
> GetLegendGraphic"
> "ows_enable_request"  "GetCapabilities GetMap GetFeatureInfo
> GetLegendGraphic"
> "ows_extent" "-180 -90 180 90"
> "wfs_title"           "wfs test"
> #necessary for the WMS GetFeatureInfo request
> "WMS_FEATURE_INFO_MIME_TYPE" "text/html"
> END
>
> END
>
> LEGEND
> STATUS on
> KEYSIZE 10 10
> LABEL
> SIZE 9
> COLOR 0 0 0
> TYPE truetype
> ENCODING UTF-8
> FONT sans
> FORCE false
> PARTIALS true
> POSITION AUTO
> END
> TEMPLATE "template/legend.html" # HTML template file
> END
>
> LAYER
> NAME satellite_mod
>
> METADATA
> "wms_title"     "World Map Lite"
> "unit"          "false"
> END #end of wms metadata
>
> DATA data/satelliteMod.png
> TYPE RASTER
> STATUS ON
> END
> #map end
> END
>
>
> * Dockerfile
>
> FROM debian:jessie
>
> ENV GMS_DIR=/genes-mapserver
> ENV LANG C.UTF-8
>
> # Update and upgrade system
> RUN apt-get -qq update --fix-missing && \
> apt-get install -y cgi-mapserver mapserver-bin
>
>
> RUN mkdir ${GMS_DIR}
>
> VOLUME ${GMS_DIR}
>
> ENTRYPOINT ["/usr/lib/cgi-bin/mapserv"]
>
>
> The actual tests are done within the container by:
>
> sudo docker run -v ~/src/genes-mapserver/:/genes-mapserver --rm
> --entrypoint=/bin/bash -ti renzok/mapserver-cgi
>
>
> thanks for reading :)
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users


More information about the mapserver-users mailing list