0

I am trying to export a raster image from a WMS using gdal_translate and have not had any success. I have read http://www.gdal.org/frmt_wms.html but still no success. In my XML file, what should the values for SizeX and SizeY represent?

Here is the command line parameters: gdal_translate -of JPEG -outsize 500 250 ac3.xml ac3.jpg.

Error Message: Input file size is 2666666, 1333333 0ERROR 1: GDALWMS: The server returned unknown exception. ERROR 1: ac3.xml, band 1: IReadBlock failed at X offset 0, Y offset 0

Here is my ac3.xml:

<GDAL_WMS>
<Service name="WMS">
<Version>1</Version>
<ServerUrl>http://data1.commons.psu.edu/arcgis/services/pasda/AlleghenyCountyImagery2010/MapServer/WMSServer?</ServerUrl>
<Layers>AlleghenyCountyImagery2010</Layers>
</Service>
<DataWindow>
<UpperLeftX>-80.413955</UpperLeftX>
<UpperLeftY>40.717648</UpperLeftY>
<LowerRightX>-79.641264</LowerRightX>
<LowerRightY>40.153982</LowerRightY>
<SizeX>2666666</SizeX>
<SizeY>1333333</SizeY>
</DataWindow>
<Projection>EPSG:4326</Projection>
<BlockSizeX>256</BlockSizeX>
<BlockSizeY>256</BlockSizeY>
</GDAL_WMS>

1 Answer 1

2

You must look at the GetCapabilities of that server. The layer name is not "AlleghenyCountyImagery2010" but it is "0". Edit that into your XML file and your gdal_translate command will work.

SizeX and SizeY comes from extents and native resolution of the WMS service. If the site is 100 km wide and resolution is 1 m/pixel then SizeX is 100000.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.