<div dir="ltr">Hi,<br><div><br></div><div>I'm generating WMS service description files as described here: <a href="https://gdal.org/drivers/raster/wms.html#generation-of-wms-service-description-xml-file">https://gdal.org/drivers/raster/wms.html#generation-of-wms-service-description-xml-file</a></div><div><br></div><div>This works well, but I wonder if there's a way to request the image from the WMS server to be transparent.  </div><div><br></div><div>If I use gdal_translate to create the WMS service description file like this:</div><div><br></div><div><font face="monospace">gdal_translate "WMS:<a href="https://maps-public.geo.nyu.edu:443/geoserver/wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=sdr%3Anyu_2451_43745&SRS=EPSG:4326&BBOX=-119.265762329102,35.2621765136719,-118.825294494629,35.4424705505371">https://maps-public.geo.nyu.edu:443/geoserver/wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=sdr%3Anyu_2451_43745&SRS=EPSG:4326&BBOX=-119.265762329102,35.2621765136719,-118.825294494629,35.4424705505371</a>" service.xml -of WMS</font><br></div><div><br></div><div>then I get this:</div><div><br></div><div><div style="color:rgb(0,0,0);font-size:14px;line-height:19px;white-space:pre"><div style=""><span style="color:rgb(128,0,0)"><font face="monospace"><GDAL_WMS></font></span></div><div style=""><font face="monospace">  <span style="color:rgb(128,0,0)"><Service</span> <span style="color:rgb(255,0,0)">name</span>=<span style="color:rgb(0,0,255)">"WMS"</span><span style="color:rgb(128,0,0)">></span></font></div><div style=""><font face="monospace">    <span style="color:rgb(128,0,0)"><Version></span>1.1.1<span style="color:rgb(128,0,0)"></Version></span></font></div><div style=""><font face="monospace">    <span style="color:rgb(128,0,0)"><ServerUrl></span><a href="https://maps-public.geo.nyu.edu:443/geoserver/wms?SERVICE=WMS">https://maps-public.geo.nyu.edu:443/geoserver/wms?SERVICE=WMS</a><span style="color:rgb(128,0,0)"></ServerUrl></span></font></div><div style=""><font face="monospace">    <span style="color:rgb(128,0,0)"><Layers></span>sdr%3Anyu_2451_43745<span style="color:rgb(128,0,0)"></Layers></span></font></div><div style=""><font face="monospace">    <span style="color:rgb(128,0,0)"><SRS></span>EPSG:4326<span style="color:rgb(128,0,0)"></SRS></span></font></div><div style=""><font face="monospace">    <span style="color:rgb(128,0,0)"><ImageFormat></span>image/jpeg<span style="color:rgb(128,0,0)"></ImageFormat></span></font></div><div style=""><font face="monospace">    <span style="color:rgb(128,0,0)"><Transparent></span>FALSE<span style="color:rgb(128,0,0)"></Transparent></span></font></div><div style=""><font face="monospace">    <span style="color:rgb(128,0,0)"><BBoxOrder></span>xyXY<span style="color:rgb(128,0,0)"></BBoxOrder></span></font></div><div style=""><font face="monospace">  <span style="color:rgb(128,0,0)"></Service></span></font></div><div style=""><font face="monospace">  <span style="color:rgb(128,0,0)"><DataWindow></span></font></div><div style=""><font face="monospace">    <span style="color:rgb(128,0,0)"><UpperLeftX></span>-119.265762329102<span style="color:rgb(128,0,0)"></UpperLeftX></span></font></div><div style=""><font face="monospace">    <span style="color:rgb(128,0,0)"><UpperLeftY></span>35.4424705505371<span style="color:rgb(128,0,0)"></UpperLeftY></span></font></div><div style=""><font face="monospace">    <span style="color:rgb(128,0,0)"><LowerRightX></span>-118.825294494629<span style="color:rgb(128,0,0)"></LowerRightX></span></font></div><div style=""><font face="monospace">    <span style="color:rgb(128,0,0)"><LowerRightY></span>35.2621765136719<span style="color:rgb(128,0,0)"></LowerRightY></span></font></div><div style=""><font face="monospace">    <span style="color:rgb(128,0,0)"><SizeX></span>1073741824<span style="color:rgb(128,0,0)"></SizeX></span></font></div><div style=""><font face="monospace">    <span style="color:rgb(128,0,0)"><SizeY></span>439508252<span style="color:rgb(128,0,0)"></SizeY></span></font></div><div style=""><font face="monospace">  <span style="color:rgb(128,0,0)"></DataWindow></span></font></div><div style=""><font face="monospace">  <span style="color:rgb(128,0,0)"><BandsCount></span>3<span style="color:rgb(128,0,0)"></BandsCount></span></font></div><div style=""><font face="monospace">  <span style="color:rgb(128,0,0)"><BlockSizeX></span>1024<span style="color:rgb(128,0,0)"></BlockSizeX></span></font></div><div style=""><font face="monospace">  <span style="color:rgb(128,0,0)"><BlockSizeY></span>1024<span style="color:rgb(128,0,0)"></BlockSizeY></span></font></div><div style=""><font face="monospace">  <span style="color:rgb(128,0,0)"><OverviewCount></span>20<span style="color:rgb(128,0,0)"></OverviewCount></span></font></div><div style=""><span style="color:rgb(128,0,0)"><font face="monospace"></GDAL_WMS></font></span></div><div style="font-family:Consolas,"Courier New",monospace"><span style="color:rgb(128,0,0)"><br></span></div><div style=""><span style="color:rgb(128,0,0)"><font face="arial, sans-serif">I have discovered that if I slightly edit three lines the service description like this:</font></span></div><div style="font-family:Consolas,"Courier New",monospace"><br></div><div style=""><div style="line-height:19px"><div style="font-family:Consolas,"Courier New",monospace"><span style="color:rgb(163,21,21)">    <ImageFormat>image/geotiff</ImageFormat></span></div><div style="font-family:Consolas,"Courier New",monospace"><span style="color:rgb(163,21,21)">    <Transparent>TRUE</Transparent></span></div><div style="font-family:Consolas,"Courier New",monospace"><span style="color:rgb(163,21,21)">    <BandsCount>4</BandsCount></span><br></div><div style="font-family:Consolas,"Courier New",monospace"><span style="color:rgb(163,21,21)"><br></span></div><div style=""><span style="color:rgb(163,21,21)"><font face="arial, sans-serif">then my output image is transparent if I compare these two output files:</font></span></div><div style="font-family:Consolas,"Courier New",monospace"><br></div><div style="font-family:Consolas,"Courier New",monospace">gdal_translate -outsize 512 512 -projwin -119.1 35.4 -119 35.3 service.xml bakersfield.tif
</div><div style="font-family:Consolas,"Courier New",monospace">gdal_translate -outsize 512 512 -projwin -119.1 35.4 -119 35.3 service_trans.xml bakersfield_trans.tif<span style="color:rgb(163,21,21)"><br></span></div><div style="font-family:Consolas,"Courier New",monospace"><br></div><div style=""><font face="arial, sans-serif">Are there some options I can use in the first gdal_translate command above to generate the WMS description file so that </font></div><div style=""><font face="arial, sans-serif">it retrieves transparent images if the server supports transparency?</font></div><div style=""><font face="arial, sans-serif"><br></font></div><div style=""><font face="arial, sans-serif">(I am actually creating the service description file in C++ code using CreateCopy, but I believe it's easy to prototype with the CLI.)</font></div><div style=""><font face="arial, sans-serif"><br></font></div><div style=""><font face="arial, sans-serif">Thanks very much,</font></div><div style=""><font face="arial, sans-serif"><br></font></div><div style=""><font face="arial, sans-serif">carl</font></div><div style=""><font face="arial, sans-serif"><br></font></div><div style=""><font face="arial, sans-serif"><br></font></div><div style="font-family:Consolas,"Courier New",monospace">

</div></div><font face="Consolas, Courier New, monospace">

</font></div></div></div></div>