[mapserver-users] Mapserver 6.2.1 fails to read remote WMS in png format

Daniel Morissette dmorissette at mapgears.com
Thu Apr 25 07:26:47 PDT 2013


What if you try to gdal_translate it to a TIFF or JPEG for instance? 
Please make sure you use the gdal_translate tool from the exact same 
MS4W package as what your MapServer is using.

Daniel


On 13-04-25 10:17 AM, Rahkonen Jukka wrote:
> Hi,
>
> Yes, I have checked that png files saved from both services I have been testing are OK.  I know that our own server is using this outputformat
> OUTPUTFORMAT
>        NAME 'AGG_Q'
>        MIMETYPE "image/png"
>        DRIVER "AGG/PNG"
>        EXTENSION "png"
>        IMAGEMODE RGB
>        FORMATOPTION "QUANTIZE_FORCE=ON"
>        FORMATOPTION "QUANTIZE_DITHER=OFF"
>        FORMATOPTION "QUANTIZE_COLORS=256"
>
> GDAL 1.10dev understands the saved image this way:
>
> E:\>gdalinfo temp.png
> Driver: PNG/Portable Network Graphics
> Files: temp.png
> Size is 459, 353
> Coordinate System is `'
> Corner Coordinates:
> Upper Left  (    0.0,    0.0)
> Lower Left  (    0.0,  353.0)
> Upper Right (  459.0,    0.0)
> Lower Right (  459.0,  353.0)
> Center      (  229.5,  176.5)
> Band 1 Block=459x1 Type=Byte, ColorInterp=Palette
>    Color Table (RGB with 256 entries)
>      0: 62,135,124,255
>      1: 52,108,102,255
>      2: 46,110,106,255
>      3: 58,131,122,255
>      4: 78,153,135,255
>      5: 50,110,102,255
>      6: 52,116,106,255
>      7: 50,108,102,255
>      8: 54,116,110,255
>      9: 213,213,201,255
>     10: 223,247,239,255
>     11: 66,143,131,255
>     12: 52,110,106,255
>     13: 64,139,122,255
>     14: 76,149,133,255
>     15: 64,126,116,255
>     16: 52,124,112,255
>     17: 54,129,118,255
>     18: 76,149,124,255
>     19: 74,141,124,255
>     20: 82,151,135,255
>     21: 94,151,135,255
>     22: 76,143,131,255
>     23: 82,147,131,255
>     24: 50,106,102,255
>     25: 74,151,131,255
>     26: 74,147,129,255
>     27: 62,139,124,255
>     28: 72,141,118,255
>     29: 44,104,100,255
>     30: 141,110,116,255
>     31: 84,151,126,255
>     32: 94,151,131,255
>     33: 64,129,120,255
>     34: 163,143,135,255
>     35: 46,108,102,255
>     36: 60,131,120,255
>     37: 137,102,100,255
>     38: 88,155,133,255
>     39: 114,124,112,255
>     40: 90,126,102,255
>     41: 110,118,104,255
>     42: 76,131,118,255
>     43: 149,133,126,255
>     44: 88,159,139,255
>     45: 82,147,124,255
>     46: 106,151,122,255
>     47: 100,157,135,255
>     48: 50,116,110,255
>     49: 171,145,147,255
>     50: 145,181,157,255
>     51: 157,129,126,255
>     52: 90,141,120,255
>     53: 90,149,126,255
>     54: 157,139,135,255
>     55: 139,122,114,255
>     56: 161,143,141,255
>     57: 84,147,122,255
>     58: 147,112,116,255
>     59: 100,165,145,255
>     60: 163,131,133,255
>     61: 139,108,108,255
>     62: 76,141,126,255
>     63: 147,122,118,255
>     64: 46,106,102,255
>     65: 72,145,120,255
>     66: 151,149,135,255
>     67: 135,124,120,255
>     68: 84,143,116,255
>     69: 141,139,131,255
>     70: 163,165,153,255
>     71: 135,163,141,255
>     72: 106,104,96,255
>     73: 72,149,131,255
>     74: 177,135,135,255
>     75: 161,159,147,255
>     76: 163,149,147,255
>     77: 82,145,126,255
>     78: 157,126,133,255
>     79: 193,159,159,255
>     80: 100,139,110,255
>     81: 181,147,149,255
>     82: 151,122,124,255
>     83: 141,126,122,255
>     84: 161,199,175,255
>     85: 157,177,159,255
>     86: 177,118,100,255
>     87: 185,157,157,255
>     88: 183,161,157,255
>     89: 169,126,126,255
>     90: 114,104,102,255
>     91: 171,159,149,255
>     92: 151,163,149,255
>     93: 106,139,120,255
>     94: 153,183,159,255
>     95: 171,145,141,255
>     96: 151,155,147,255
>     97: 161,124,126,255
>     98: 151,143,135,255
>     99: 52,129,116,255
>    100: 135,155,135,255
>    101: 124,155,135,255
>    102: 189,183,173,255
>    103: 135,102,106,255
>    104: 96,151,122,255
>    105: 54,120,112,255
>    106: 167,139,135,255
>    107: 139,102,108,255
>    108: 100,161,137,255
>    109: 114,92,92,255
>    110: 171,199,179,255
>    111: 177,147,147,255
>    112: 137,135,124,255
>    113: 171,157,155,255
>    114: 151,155,141,255
>    115: 139,163,149,255
>    116: 108,88,84,255
>    117: 203,183,173,255
>    118: 171,167,157,255
>    119: 179,229,205,255
>    120: 153,187,167,255
>    121: 131,92,98,255
>    122: 183,243,221,255
>    123: 131,110,112,255
>    124: 163,181,167,255
>    125: 179,205,189,255
>    126: 161,205,183,255
>    127: 181,189,175,255
>    128: 175,219,195,255
>    129: 173,179,167,255
>    130: 181,175,165,255
>    131: 179,163,159,255
>    132: 163,157,151,255
>    133: 161,217,193,255
>    134: 161,120,120,255
>    135: 177,157,151,255
>    136: 173,187,173,255
>    137: 139,147,135,255
>    138: 149,139,133,255
>    139: 126,88,92,255
>    140: 161,189,171,255
>    141: 52,122,112,255
>    142: 171,151,147,255
>    143: 145,187,167,255
>    144: 126,122,114,255
>    145: 96,98,92,255
>    146: 131,141,131,255
>    147: 58,131,120,255
>    148: 126,147,131,255
>    149: 173,175,161,255
>    150: 94,86,82,255
>    151: 161,153,145,255
>    152: 167,131,135,255
>    153: 137,179,153,255
>    154: 108,76,82,255
>    155: 122,104,100,255
>    156: 151,118,120,255
>    157: 163,171,157,255
>    158: 163,135,135,255
>    159: 124,118,108,255
>    160: 124,137,122,255
>    161: 80,86,80,255
>    162: 131,100,100,255
>    163: 177,139,143,255
>    164: 161,149,141,255
>    165: 76,68,70,255
>    166: 151,118,122,255
>    167: 137,161,145,255
>    168: 171,133,135,255
>    169: 106,72,76,255
>    170: 82,141,120,255
>    171: 151,199,173,255
>    172: 94,70,72,255
>    173: 157,133,133,255
>    174: 110,82,82,255
>    175: 141,120,120,255
>    176: 94,157,135,255
>    177: 72,100,96,255
>    178: 151,112,114,255
>    179: 143,171,153,255
>    180: 122,92,98,255
>    181: 114,98,94,255
>    182: 114,84,90,255
>    183: 70,145,126,255
>    184: 147,116,118,255
>    185: 149,133,133,255
>    186: 120,88,90,255
>    187: 153,171,155,255
>    188: 129,126,120,255
>    189: 106,90,90,255
>    190: 86,151,135,255
>    191: 139,116,112,255
>    192: 135,171,149,255
>    193: 84,157,135,255
>    194: 129,110,106,255
>    195: 58,126,118,255
>    196: 92,139,110,255
>    197: 151,145,141,255
>    198: 72,139,120,255
>    199: 171,135,141,255
>    200: 141,108,112,255
>    201: 76,149,129,255
>    202: 163,137,141,255
>    203: 58,122,114,255
>    204: 171,141,143,255
>    205: 157,120,124,255
>    206: 135,153,141,255
>    207: 153,126,131,255
>    208: 62,137,122,255
>    209: 84,139,110,255
>    210: 149,126,126,255
>    211: 90,147,120,255
>    212: 147,106,110,255
>    213: 124,98,98,255
>    214: 126,104,106,255
>    215: 82,151,131,255
>    216: 82,155,131,255
>    217: 46,104,100,255
>    218: 82,141,126,255
>    219: 42,102,98,255
>    220: 48,116,108,255
>    221: 44,114,106,255
>    222: 68,147,129,255
>    223: 86,149,131,255
>    224: 58,120,112,255
>    225: 163,126,131,255
>    226: 72,147,124,255
>    227: 48,114,106,255
>    228: 56,131,118,255
>    229: 74,139,114,255
>    230: 46,102,98,255
>    231: 54,126,116,255
>    232: 50,110,106,255
>    233: 68,141,129,255
>    234: 58,135,124,255
>    235: 66,139,126,255
>    236: 78,153,131,255
>    237: 70,143,124,255
>    238: 58,116,110,255
>    239: 40,98,96,255
>    240: 52,124,116,255
>    241: 60,122,114,255
>    242: 42,104,100,255
>    243: 44,110,104,255
>    244: 54,116,108,255
>    245: 82,143,131,255
>    246: 66,143,129,255
>    247: 64,137,118,255
>    248: 62,137,124,255
>    249: 60,135,122,255
>    250: 48,120,112,255
>    251: 62,139,126,255
>    252: 54,112,106,255
>    253: 56,133,122,255
>    254: 46,108,102,255
>    255: 255,255,255,255
>
> -Jukka-
>
>
> Daniel Morissette wrote:
>>
>> Hi Jukka,
>>
>> IIRC, a few releases ago (not sure if that was in 6.0 or before) we got rid of all
>> native raster reading code in MapServer and started relying solely on GDAL
>> for raster input. i.e. before that we used to read PNG input directly in
>> MapServer code using libpng, and now we do it through GDAL. That could
>> possibly explain why you get different behaviors, but doesn't explain why
>> your PNG cannot be read by GDAL.
>>
>> Two things to check:
>>
>> 1- Does the image/png request captured from the logs work from the server
>> machine (using wget for instance)? Does it return a valid PNG image?
>>
>> 2- Save the output of that request with a command such as "wget https://... -
>> O /tmp/test.png" and try running gdalinfo on the output.
>> Maybe that will give some hints.
>>
>> Daniel
>>
>>
>> On 13-04-25 8:05 AM, Rahkonen Jukka wrote:
>>> Hi,
>>>
>>> I was testing Mapserver 6.2.1 from the MS4W 3.0.1beta-1 installation and
>> thought that there was something wrong with the connection.  However, the
>> problem seems to be in Mapserver side.  I have been using
>> &FORMAT=image/png for reading the remote WMS with Mapserver 6.0.1
>> but with MS 6.2.1 it does not work.  After changing  image format into
>> image/jpeg Mapserver can again cascade the remote WMS.
>>>
>>> Part of the errorlog is in the attachment but the most relevant parts
>>> are here
>>>
>>> This request with FORMAT=image/jpeg works
>>>
>>> [Thu Apr 25 14:30:24 2013].970000 HTTP request: id=1,
>>>
>> https://...&FORMAT=image/jpeg&STYLES=&HEIGHT=353&VERSION=1.1.1&S
>> RS=EPS
>>>
>> G:3067&WIDTH=459&BBOX=406810.908602495,7216210.70370872,407078.361
>> 0453
>>>
>> 37,7216416.39153513&TRANSPARENT=TRUE&EXCEPTIONS=application/vnd.o
>> gc.se
>>> _inimage
>>> ....................
>>>    [Thu Apr 25 14:30:27 2013].354000 msDrawRasterLayerGDAL():
>>> red,green,blue,alpha bands = 1,2,3,0 [Thu Apr 25 14:30:27 2013].372000
>>> msDrawMap(): Layer 1 (test), 0.022s [Thu Apr 25 14:30:27 2013].372000
>>> msDrawMap(): Drawing Label Cache, 0.000s [Thu Apr 25 14:30:27
>>> 2013].372000 msDrawMap() total time: 2.408s [Thu Apr 25 14:30:27
>>> 2013].590000 msSaveImage(stdout) total time: 0.218s [Thu Apr 25
>>> 14:30:27 2013].592000 mapserv request processing time (msLoadMap not
>>> incl.): 2.629s
>>>
>>> This request with FORMAT=image/png does not work
>>>
>>> [Thu Apr 25 14:31:13 2013].915000 HTTP request: id=1,
>>>
>> https://...&FORMAT=image/png&STYLES=&HEIGHT=353&VERSION=1.1.1&SR
>> S=EPSG
>>>
>> :3067&WIDTH=459&BBOX=406508.434778249,7215858.43375314,407593.6153
>> 7966
>>>
>> 5,7216693.00619824&TRANSPARENT=TRUE&EXCEPTIONS=application/vnd.og
>> c.se_
>>> inimage
>>> .........................
>>> [Thu Apr 25 14:31:18 2013].349000 msDrawRasterLayerGDAL():
>>> red,green,blue,alpha bands = 1,0,0,0 [Thu Apr 25 14:31:18 2013].349000
>>> drawGDAL(): Unable to access file. GDALDatasetRasterIO() failed:
>> GetBlockRef failed at X block offset 0, Y block offset 0 [Thu Apr 25 14:31:18
>> 2013].349000 msDrawMap(): WMS connection error. Failed to draw WMS
>> layer named 'test'. This most likely happened because the remote WMS
>> server returned an invalid image, and XML exception or another unexpected
>> result in response to the GetMap request. Also check and make sure that the
>> layer's connection URL is valid.
>>> [Thu Apr 25 14:31:18 2013].349000 mapserv request processing time
>>> (msLoadMap not incl.): 4.441s
>>>
>>>
>>> It looks like GDAL cannot find correct bands from the png output of the
>> remote WMS: " msDrawRasterLayerGDAL(): red,green,blue,alpha bands =
>> 1,0,0,0". However, Mapserver 6.0.1 with GDAL 1.8 can cascade this service
>> fine and all my WMS clients work well with the remote WMS by using
>> image/png format.  I made also another test by trying to cascade our own
>> Mapserver 6.0.1 and the result was the same:  if I read data as image/png
>> remote WMS I get the  "GDALDatasetRasterIO() failed" error.
>>>
>>> I am not sure if this is Mapserver, GDAL or MS4W bug. Any opinions?
>>>
>>> -Jukka Rahkonen-
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> mapserver-users mailing list
>>> mapserver-users at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>>>
>>
>>
>> --
>> Daniel Morissette
>> http://www.mapgears.com/
>> Provider of Professional MapServer Support since 2000
>>
>> _______________________________________________
>> mapserver-users mailing list
>> mapserver-users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>


-- 
Daniel Morissette
http://www.mapgears.com/
Provider of Professional MapServer Support since 2000




More information about the MapServer-users mailing list