[Qgis-developer] PyQGIS save raster as rendered image, then use GDAL tools on it

Tom Chadwin tom.chadwin at nnpa.org.uk
Fri Jan 8 03:57:40 PST 2016


The output of `QgsRasterFileWriter` *is* styled. The output of
`warpreproject` is *not* styled, but the `.tif` is accompanied by a
`.aux.xml` file which appears to have colour information in it:

    <PAMDataset>
      <PAMRasterBand band="1">
        <Histograms>
          <HistItem>
            <HistMin>-0.498046875</HistMin>
            <HistMax>255.498046875</HistMax>
            <BucketCount>256</BucketCount>
            <IncludeOutOfRange>0</IncludeOutOfRange>
            <Approximate>1</Approximate>
           
<HistCounts>314|4|3|2|3|5|4|4|5|8|10|9|16|16|23|26|37|46|58|62|69|77|77|94|127|94|131|136|133|162|169|172|171|184|200|186|207|196|186|177|179|194|182|182|178|177|181|195|196|196|195|195|179|226|206|215|193|197|202|212|207|206|232|204|229|253|233|240|248|234|234|268|240|238|259|286|268|287|259|264|255|267|268|271|256|321|277|284|317|286|290|277|312|334|319|325|323|310|349|357|347|326|337|338|336|383|374|349|411|382|382|417|406|405|414|427|404|434|447|430|468|424|446|442|450|461|448|458|457|459|412|414|469|466|443|475|464|472|481|519|504|458|473|481|514|523|522|494|542|580|604|623|686|648|707|763|808|799|819|853|932|1046|1062|1118|1145|1215|1293|1393|1335|1392|1390|1317|1232|1247|1215|1088|1032|896|847|731|708|666|608|634|556|500|484|456|433|408|406|401|386|388|414|414|387|382|340|346|382|385|368|348|334|376|359|318|339|326|357|315|319|357|333|328|329|310|344|295|300|351|347|324|358|349|363|361|347|396|386|433|395|434|479|473|523|550|644|655|672|778|882|1014|1183|1400|1681|2075|2531|3529|4851|7235|10793|60773|7297|1999</HistCounts>
          </HistItem>
        </Histograms>
        <Metadata>
          <MDI key="STATISTICS_MAXIMUM">255</MDI>
          <MDI key="STATISTICS_MEAN">203.31482680479</MDI>
          <MDI key="STATISTICS_MINIMUM">0</MDI>
          <MDI key="STATISTICS_STDDEV">63.158702013579</MDI>
        </Metadata>
      </PAMRasterBand>
    </PAMDataset>

The output of `translate` is *not* styled, and has no additional file.
However, since it's a PNG not a GeoTIFF, that's perhaps the explanation.

I've tried looking at the `expand` option of `translate`, but that gives me
image files which do not display in a web browser - I've not investigated
why.



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/PyQGIS-save-raster-as-rendered-image-then-use-GDAL-tools-on-it-tp5244204p5244276.html
Sent from the Quantum GIS - Developer mailing list archive at Nabble.com.


More information about the Qgis-developer mailing list