For posterity, here is some information about a GDAL WMS driver issue. I opened ticket 3042 to address this. I hope no one minds if I paste the transcript of the conversation below. I often search this list archive for information about GDAL issues and figure this may be useful to have in the archive. Thanks.<div>
<br></div><div><br><div class="gmail_quote"><div class="gmail_quote">Transcript of conversation:</div><div class="gmail_quote"><br></div><div class="gmail_quote"><br></div><div class="gmail_quote"><br></div><div class="gmail_quote">
<span class="Apple-tab-span" style="white-space:pre">        </span> Joel Odom <<a href="mailto:joelodom@gmail.com">joelodom@gmail.com</a>></div><div class="gmail_quote">Transparency in GDAL WMS</div><div class="gmail_quote">
10 messages</div><div class="gmail_quote">Joel Odom <<a href="mailto:joelodom@gmail.com">joelodom@gmail.com</a>><span class="Apple-tab-span" style="white-space:pre">        </span> Tue, Jun 23, 2009 at 9:36 AM</div><div class="gmail_quote">
To: Frank Warmerdam <<a href="mailto:warmerdam@pobox.com">warmerdam@pobox.com</a>></div><div class="gmail_quote">Hi, Frank. I'm hitting a WMS link that returns a PNG with transparency, but the data set raster count says that it has only three bands. We're on GDAL 1.5.2. Another researcher here says that newer versions of GDAL support WMS transparency, but I can't find any mention of it in this group or on in Trac. Is it correct that this feature was put in a later release and do you know which release? Thanks.</div>
<div class="gmail_quote"><br></div><div class="gmail_quote">(By the way, there is an early, fairly buggy, alpha of FalconView 4.3 available for free download now from <a href="http://www.falconview.org/">http://www.falconview.org/</a>. We've also posted the FalconView source code there.)</div>
<div class="gmail_quote"><br></div><div class="gmail_quote"><br></div><div class="gmail_quote"><br></div><div class="gmail_quote">-- </div><div class="gmail_quote"><a href="http://giscoder.blogspot.com/">http://giscoder.blogspot.com/</a></div>
<div class="gmail_quote">Joel Odom <<a href="mailto:joelodom@gmail.com">joelodom@gmail.com</a>><span class="Apple-tab-span" style="white-space:pre">        </span> Tue, Jun 23, 2009 at 9:51 AM</div><div class="gmail_quote">
To: Frank Warmerdam <<a href="mailto:warmerdam@pobox.com">warmerdam@pobox.com</a>></div><div class="gmail_quote">I think this may be what the other researcher here was looking at when he said a newer version of GDAL: <a href="http://trac.osgeo.org/mapserver/ticket/83">http://trac.osgeo.org/mapserver/ticket/83</a> This ticket refers to something about 8 years ago, though, so it's probably not the issue.</div>
<div class="gmail_quote"><br></div><div class="gmail_quote">Here is the WMS request that is returning a transparent PNG. Any idea why I'm getting this back as a three band raster and not seeing an alpha band? Thanks so much.</div>
<div class="gmail_quote"><br></div><div class="gmail_quote"><a href="http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n1p.cgi?TRANSPARENT=TRUE&request=GetMap&version=1.1.0&layers=nexrad-n1p&styles=&srs=EPSG:4326&format=image/png&width=948&height=603&bbox=-106.24059800,39.92912300,-97.79391800,45.30185300">http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n1p.cgi?TRANSPARENT=TRUE&request=GetMap&version=1.1.0&layers=nexrad-n1p&styles=&srs=EPSG:4326&format=image/png&width=948&height=603&bbox=-106.24059800,39.92912300,-97.79391800,45.30185300</a></div>
<div class="gmail_quote"><br></div><div class="gmail_quote">[Quoted text hidden]</div><div class="gmail_quote">-- </div><div class="gmail_quote"><a href="http://giscoder.blogspot.com/">http://giscoder.blogspot.com/</a></div>
<div class="gmail_quote">Frank Warmerdam <<a href="mailto:warmerdam@pobox.com">warmerdam@pobox.com</a>><span class="Apple-tab-span" style="white-space:pre">        </span> Tue, Jun 23, 2009 at 10:08 AM</div><div class="gmail_quote">
To: Joel Odom <<a href="mailto:joelodom@gmail.com">joelodom@gmail.com</a>></div><div class="gmail_quote">Joel Odom wrote:</div><div class="gmail_quote">I think this may be what the other researcher here was looking at when he said a newer version of GDAL: <a href="http://trac.osgeo.org/mapserver/ticket/83">http://trac.osgeo.org/mapserver/ticket/83</a> This ticket refers to something about 8 years ago, though, so it's probably not the issue.</div>
<div class="gmail_quote"><br></div><div class="gmail_quote">Here is the WMS request that is returning a transparent PNG. Any idea why I'm getting this back as a three band raster and not seeing an alpha band? Thanks so much.</div>
<div class="gmail_quote"><br></div><div class="gmail_quote"><a href="http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n1p.cgi?TRANSPARENT=TRUE&request=GetMap&version=1.1.0&layers=nexrad-n1p&styles=&srs=EPSG:4326&format=image/png&width=948&height=603&bbox=-106.24059800,39.92912300,-97.79391800,45.30185300">http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n1p.cgi?TRANSPARENT=TRUE&request=GetMap&version=1.1.0&layers=nexrad-n1p&styles=&srs=EPSG:4326&format=image/png&width=948&height=603&bbox=-106.24059800,39.92912300,-97.79391800,45.30185300</a> <<a href="http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n1p.cgi?TRANSPARENT=TRUE&request=GetMap&version=1.1.0&layers=nexrad-n1p&styles=&srs=EPSG:4326&format=image/png&width=948&height=603&bbox=-106.24059800,39.92912300,-97.79391800,45.30185300">http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n1p.cgi?TRANSPARENT=TRUE&request=GetMap&version=1.1.0&layers=nexrad-n1p&styles=&srs=EPSG:4326&format=image/png&width=948&height=603&bbox=-106.24059800,39.92912300,-97.79391800,45.30185300</a>></div>
<div class="gmail_quote"><br></div><div class="gmail_quote">Joel,</div><div class="gmail_quote"><br></div><div class="gmail_quote">There are two ways of accomplishing transparency in PNG. One is to add an</div><div class="gmail_quote">
alpha band. The other is to designate a color index as transparent in</div><div class="gmail_quote">a single band image with a color table. That is the approach used in this</div><div class="gmail_quote">image.</div><div class="gmail_quote">
<br></div><div class="gmail_quote">Driver: PNG/Portable Network Graphics</div><div class="gmail_quote">Files: /wrk/home/warmerda/n1p.cgi.png</div><div class="gmail_quote">Size is 948, 603</div><div class="gmail_quote">Coordinate System is `'</div>
<div class="gmail_quote">Corner Coordinates:</div><div class="gmail_quote">Upper Left ( 0.0, 0.0)</div><div class="gmail_quote">Lower Left ( 0.0, 603.0)</div><div class="gmail_quote">Upper Right ( 948.0, 0.0)</div>
<div class="gmail_quote">Lower Right ( 948.0, 603.0)</div><div class="gmail_quote">Center ( 474.0, 301.5)</div><div class="gmail_quote">Band 1 Block=948x1 Type=Byte, ColorInterp=Palette</div><div class="gmail_quote">
NoData Value=0</div><div class="gmail_quote"> Color Table (RGB with 45 entries)</div><div class="gmail_quote"> 0: 255,255,255,0</div><div class="gmail_quote"> 1: 104,34,139,255</div><div class="gmail_quote"> 2: 154,50,205,255</div>
<div class="gmail_quote"> 3: 178,58,238,255</div><div class="gmail_quote"> 4: 191,62,255,255</div><div class="gmail_quote"> 5: 153,85,201,255</div><div class="gmail_quote">...</div><div class="gmail_quote"><br></div>
<div class="gmail_quote">Note that alpha=0 in the color value for index zero. The "nodata" metadata</div><div class="gmail_quote">is also set to refer to color index zero. So for this image all zero pixels</div>
<div class="gmail_quote">should be treated as transparent.</div><div class="gmail_quote"><br></div><div class="gmail_quote">Does that address your problem?</div><div class="gmail_quote"><br></div><div class="gmail_quote">
Hopefully I can try out FalconView soon. I skimmed the page and I'm</div><div class="gmail_quote">impressed with the project.</div><div class="gmail_quote"><br></div><div class="gmail_quote">Best regards,</div><div class="gmail_quote">
-- </div><div class="gmail_quote">---------------------------------------+--------------------------------------</div><div class="gmail_quote">I set the clouds in motion - turn up | Frank Warmerdam, <a href="mailto:warmerdam@pobox.com">warmerdam@pobox.com</a></div>
<div class="gmail_quote">light and sound - activate the windows | <a href="http://pobox.com/~warmerdam">http://pobox.com/~warmerdam</a></div><div class="gmail_quote">and watch the world go round - Rush | Geospatial Programmer for Rent</div>
<div class="gmail_quote"><br></div><div class="gmail_quote">Joel Odom <<a href="mailto:joelodom@gmail.com">joelodom@gmail.com</a>><span class="Apple-tab-span" style="white-space:pre">        </span> Tue, Jun 23, 2009 at 10:57 AM</div>
<div class="gmail_quote">To: Frank Warmerdam <<a href="mailto:warmerdam@pobox.com">warmerdam@pobox.com</a>></div><div class="gmail_quote">Thanks, Frank. That gives me a lot of insight into what's going on, but it raises a new question. When I hit the WMS using GDALOpen on an XML file with the WMS connect data, I get something different than when I hit the URL below with my browser, save the image, then open the saved PNG file with GDALOpen. I see the color table when I open the PNG and see the single band raster, but rasterBand->GetColorTable() returns null when I open the WMS from the XML file and I see a three band raster. Why would I get back different data from the different data sources? It's like the WMS data source is doing some interpretation on the image that discards original single band image and creates a new three band image with no transparency.</div>
<div class="gmail_quote"><br></div><div class="gmail_quote">Thanks for checking out FalconView. We've been very popular in DoD mission planning for about 15 years now. We're opening up to the public as an open-source GIS product. Part of that effort involves aligning with OGC standards like WMS, KML, etc. We're using GDAL and OGR as a big part of that effort and really appreciate the product.</div>
<div class="gmail_quote"><br></div><div class="gmail_quote"><br></div><div class="gmail_quote">[Quoted text hidden]</div><div class="gmail_quote">-- </div><div class="gmail_quote"><a href="http://giscoder.blogspot.com/">http://giscoder.blogspot.com/</a></div>
<div class="gmail_quote">Frank Warmerdam <<a href="mailto:warmerdam@pobox.com">warmerdam@pobox.com</a>><span class="Apple-tab-span" style="white-space:pre">        </span> Tue, Jun 23, 2009 at 11:10 AM</div><div class="gmail_quote">
To: Joel Odom <<a href="mailto:joelodom@gmail.com">joelodom@gmail.com</a>></div><div class="gmail_quote">Joel Odom wrote:</div><div class="gmail_quote">Thanks, Frank. That gives me a lot of insight into what's going on, but it raises a new question. When I hit the WMS using GDALOpen on an XML file with the WMS connect data, I get something different than when I hit the URL below with my browser, save the image, then open the saved PNG file with GDALOpen. I see the color table when I open the PNG and see the single band raster, but rasterBand->GetColorTable() returns null when I open the WMS from the XML file and I see a three band raster. Why would I get back different data from the different data sources? It's like the WMS data source is doing some interpretation on the image that discards original single band image and creates a new three band image with no transparency.</div>
<div class="gmail_quote"><br></div><div class="gmail_quote">Joel,</div><div class="gmail_quote"><br></div><div class="gmail_quote">Could you provide your wms xml control file for GDAL? I'd like to try</div><div class="gmail_quote">
this. I was not really much involved in the development of the GDAL WMS</div><div class="gmail_quote">driver so I'm not clear on how it works internally. It appears to be</div><div class="gmail_quote">doing substantial image manipulation and it might need some further</div>
<div class="gmail_quote">adjustments for this case.</div><div class="gmail_quote"><br></div><div class="gmail_quote">Thanks for checking out FalconView. We've been very popular in DoD mission planning for about 15 years now. We're opening up to the public as an open-source GIS product. Part of that effort involves aligning with OGC standards like WMS, KML, etc. We're using GDAL and OGR as a big part of that effort and really appreciate the product.</div>
<div class="gmail_quote"><br></div><div class="gmail_quote">Excellent!</div><div class="gmail_quote">[Quoted text hidden]</div><div class="gmail_quote">Joel Odom <<a href="mailto:joelodom@gmail.com">joelodom@gmail.com</a>><span class="Apple-tab-span" style="white-space:pre">        </span> Tue, Jun 23, 2009 at 11:15 AM</div>
<div class="gmail_quote">To: Frank Warmerdam <<a href="mailto:warmerdam@pobox.com">warmerdam@pobox.com</a>></div><div class="gmail_quote">Here it is. I'm constructing this as an in-memory string, saving it to an in-memory file using the VSI stuff, then calling GDALOpen on the file. Thanks!</div>
<div class="gmail_quote"><br></div><div class="gmail_quote"><br></div><div class="gmail_quote"><GDAL_WMS></div><div class="gmail_quote"> <Service name="WMS"></div><div class="gmail_quote"> <ServerURL><a href="http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n1p.cgi?TRANSPARENT=TRUE">http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n1p.cgi?TRANSPARENT=TRUE</a></ServerURL></div>
<div class="gmail_quote"> <ImageFormat>image/png</ImageFormat></div><div class="gmail_quote"> <Layers>nexrad-n1p</Layers></div><div class="gmail_quote"> </Service></div><div class="gmail_quote">
<DataWindow></div><div class="gmail_quote"> <UpperLeftX>-102.017258</UpperLeftX></div><div class="gmail_quote"> <UpperLeftY>47.974853</UpperLeftY></div><div class="gmail_quote"> <LowerRightX>-93.570578</LowerRightX></div>
<div class="gmail_quote"> <LowerRightY>42.602123</LowerRightY></div><div class="gmail_quote"> <SizeX>948</SizeX></div><div class="gmail_quote"> <SizeY>603</SizeY></div><div class="gmail_quote">
</DataWindow></div><div class="gmail_quote"> <Timeout>45</Timeout></div><div class="gmail_quote"></GDAL_WMS></div><div class="gmail_quote"><br></div><div class="gmail_quote"><br></div><div class="gmail_quote">
[Quoted text hidden]</div><div class="gmail_quote">-- </div><div class="gmail_quote"><a href="http://giscoder.blogspot.com/">http://giscoder.blogspot.com/</a></div><div class="gmail_quote">Frank Warmerdam <<a href="mailto:warmerdam@pobox.com">warmerdam@pobox.com</a>><span class="Apple-tab-span" style="white-space:pre">        </span> Tue, Jun 23, 2009 at 11:52 AM</div>
<div class="gmail_quote">To: Joel Odom <<a href="mailto:joelodom@gmail.com">joelodom@gmail.com</a>></div><div class="gmail_quote">Joel Odom wrote:</div><div class="gmail_quote">Here it is. I'm constructing this as an in-memory string, saving it to an in-memory file using the VSI stuff, then calling GDALOpen on the file. Thanks!</div>
<div class="gmail_quote"><br></div><div class="gmail_quote">Joel,</div><div class="gmail_quote"><br></div><div class="gmail_quote">I see what you mean. I believe the approach taken in the WMS driver is</div><div class="gmail_quote">
essentially obliterating any concept of transparency in the result. It</div><div class="gmail_quote">would take some non-trivial additional development in the WMS driver to</div><div class="gmail_quote">address this issue. I'm not in a position to do it.</div>
<div class="gmail_quote"><br></div><div class="gmail_quote">You might want to take up the issue with Adam Nowaki who wrote the the</div><div class="gmail_quote">driver. Possibly I'm missing something, or perhaps he would be willing</div>
<div class="gmail_quote">to do some work on this.</div><div class="gmail_quote">[Quoted text hidden]</div><div class="gmail_quote">Joel Odom <<a href="mailto:joelodom@gmail.com">joelodom@gmail.com</a>><span class="Apple-tab-span" style="white-space:pre">        </span> Tue, Jun 23, 2009 at 11:55 AM</div>
<div class="gmail_quote">To: Frank Warmerdam <<a href="mailto:warmerdam@pobox.com">warmerdam@pobox.com</a>></div><div class="gmail_quote">Cc: Chris Bailey <<a href="mailto:chris.bailey@gtri.gatech.edu">chris.bailey@gtri.gatech.edu</a>></div>
<div class="gmail_quote">Thanks, Frank. I appreciate that. My work-around for now is to request the URL myself then have GDAL interpret the image using whatever driver it finds appropriate for the binary image. I've almost got that working.</div>
<div class="gmail_quote"><br></div><div class="gmail_quote">Would you mind if I posted this conversation to the GDAL developers list for posterity and opened a ticket for this issue?</div><div class="gmail_quote"><br></div>
<div class="gmail_quote">Thanks again.</div><div class="gmail_quote"><br></div><div class="gmail_quote"><br></div><div class="gmail_quote">[Quoted text hidden]</div><div class="gmail_quote">-- </div><div class="gmail_quote">
<a href="http://giscoder.blogspot.com/">http://giscoder.blogspot.com/</a></div><div class="gmail_quote">Frank Warmerdam <<a href="mailto:warmerdam@pobox.com">warmerdam@pobox.com</a>><span class="Apple-tab-span" style="white-space:pre">        </span> Tue, Jun 23, 2009 at 12:01 PM</div>
<div class="gmail_quote">To: Joel Odom <<a href="mailto:joelodom@gmail.com">joelodom@gmail.com</a>></div><div class="gmail_quote">Cc: Chris Bailey <<a href="mailto:chris.bailey@gtri.gatech.edu">chris.bailey@gtri.gatech.edu</a>></div>
<div class="gmail_quote">Joel Odom wrote:</div><div class="gmail_quote">Thanks, Frank. I appreciate that. My work-around for now is to request the URL myself then have GDAL interpret the image using whatever driver it finds appropriate for the binary image. I've almost got that working.</div>
<div class="gmail_quote"><br></div><div class="gmail_quote">Would you mind if I posted this conversation to the GDAL developers list for posterity and opened a ticket for this issue?</div><div class="gmail_quote"><br></div>
<div class="gmail_quote">Joel,</div><div class="gmail_quote"><br></div><div class="gmail_quote">That would be an excellent idea.</div><div class="gmail_quote">[Quoted text hidden]</div><div class="gmail_quote">Joel Odom <<a href="mailto:joelodom@gmail.com">joelodom@gmail.com</a>><span class="Apple-tab-span" style="white-space:pre">        </span> Tue, Jun 23, 2009 at 12:17 PM</div>
<div class="gmail_quote">Draft To: <a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a></div><div class="gmail_quote">For posterity, here is some information about a GDAL WMS driver issue. I opened ticket 3042 to address this. Thanks.</div>
<div class="gmail_quote"><br></div><div class="gmail_quote"><br></div><div class="gmail_quote">[Quoted text hidden]</div><div class="gmail_quote">-- </div><div class="gmail_quote"><a href="http://giscoder.blogspot.com/">http://giscoder.blogspot.com/</a></div>
<div><br></div></div><br clear="all"><br>-- <br><a href="http://giscoder.blogspot.com/">http://giscoder.blogspot.com/</a><br>
</div>