<div dir="ltr">not shure if it's the same... not sure if the requests are for band statistics or background image prefetch of an extended canvas view (introduce 1y ago if I well remember)<div><br></div><div><div>you can simply check if bandSatatisti is available or triggered doing it with (ir R is the QgsRasterLayer)</div><div><br></div><div>renderer = R.renderer()</div><div>renderer.hasStatistics(1) # True or Flase; 1 is the band number</div><div>stat = bandStatistics(1) # this would trigger remote reading if false step before</div><div><br></div><div>bandStatistic is a QgsRasterInterface (e.g. the provider), so any provider can implement statistic calc in different way...</div><div><br></div><div><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">Luigi Pirelli<br><br>**************************************************************************************************<br>* LinkedIn: <a href="https://www.linkedin.com/in/luigipirelli" target="_blank">https://www.linkedin.com/in/luigipirelli</a><br>* Stackexchange: <a href="http://gis.stackexchange.com/users/19667/luigi-pirelli" target="_blank">http://gis.stackexchange.com/users/19667/luigi-pirelli</a><br>* GitHub: <a href="https://github.com/luipir" target="_blank">https://github.com/luipir</a><br>* Mastering QGIS 2nd Edition:<br>* <a href="https://www.packtpub.com/big-data-and-business-intelligence/mastering-qgis-second-edition" target="_blank">https://www.packtpub.com/big-data-and-business-intelligence/mastering-qgis-second-edition</a><br>* Hire me: <a href="http://goo.gl/BYRQKg" target="_blank">http://goo.gl/BYRQKg</a><br>**************************************************************************************************</div></div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 18 Jan 2019 at 14:34, Richard Duivenvoorde <<a href="mailto:rdmailings@duif.net">rdmailings@duif.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Luigi,<br>
<br>
I cannot be of help, but I think I had exactly this problem then you,<br>
when there is a OGC-WCS service with for example a huge DEM/height model.<br>
<br>
And after that QGIS is requesting several times for one extent some<br>
portion of the data (while this server is very slow on this)<br>
I was thinking about a possibility to NOT do this everytime (or at least<br>
give an option to do it ONLY on the real data available already by QGIS).<br>
<br>
Does this fit your problem?<br>
<br>
Regards,<br>
<br>
Richard Duivenvoorde<br>
<br>
ps anybody willing to play with such a dem:<br>
<br>
<a href="https://geodata.nationaalgeoregister.nl/ahn3/wcs?request=GetCapabilities&service=wcs&version=1.1.2" rel="noreferrer" target="_blank">https://geodata.nationaalgeoregister.nl/ahn3/wcs?request=GetCapabilities&service=wcs&version=1.1.2</a><br>
<br>
(epsg:28992)<br>
<br>
On 1/18/19 1:56 PM, Luigi Pirelli wrote:<br>
> Hi devs<br>
> <br>
> I face a (IMHO) an API limitation that I'm not sure is a limitation of a<br>
> feature :)<br>
> <br>
> I'm working adding SLD export for rasters as new feature and some<br>
> stretching (QgsContrastEnhancement) should be mapped differently if the<br>
> min/max values has been modified from the real min/max of the image.<br>
> <br>
> This can be simply asked to the raster with<br>
> QgsRasterLayer.statistic(<band number>). The main problem I'm faced is<br>
> that if statistic is not present it is ALWAYS calculated.<br>
> This means that if we have big images or a remote one (e.g. COG) this<br>
> would take long time!<br>
> I do not analysed any raster provider, but I suppose that min/max values<br>
> can be estimated asking to raster metadata.<br>
> <br>
> IMHO we can have an API like<br>
> QgsRasterLayer.estimatedStatistic(<band number>)<br>
> or<br>
> QgsRasterLayer.statistic(<band number>, estimated=false)<br>
> <br>
> that can return metadata values if available.<br>
> <br>
> The proposal is valid if there is no a method to get estimated<br>
> statistic, but I could be wrong and that's the reason of this post.<br>
> <br>
> Luigi Pirelli<br>
> <br>
> p.s. remember to come to <a href="http://2019.qgis.es" rel="noreferrer" target="_blank">2019.qgis.es</a> <<a href="http://2019.qgis.es" rel="noreferrer" target="_blank">http://2019.qgis.es</a>> ;) we'll<br>
> open inscription next monday!<br>
> <br>
> **************************************************************************************************<br>
> * LinkedIn: <a href="https://www.linkedin.com/in/luigipirelli" rel="noreferrer" target="_blank">https://www.linkedin.com/in/luigipirelli</a><br>
> * Stackexchange: <a href="http://gis.stackexchange.com/users/19667/luigi-pirelli" rel="noreferrer" target="_blank">http://gis.stackexchange.com/users/19667/luigi-pirelli</a><br>
> * GitHub: <a href="https://github.com/luipir" rel="noreferrer" target="_blank">https://github.com/luipir</a><br>
> * Mastering QGIS 2nd Edition:<br>
> *<br>
> <a href="https://www.packtpub.com/big-data-and-business-intelligence/mastering-qgis-second-edition" rel="noreferrer" target="_blank">https://www.packtpub.com/big-data-and-business-intelligence/mastering-qgis-second-edition</a><br>
> * Hire me: <a href="http://goo.gl/BYRQKg" rel="noreferrer" target="_blank">http://goo.gl/BYRQKg</a><br>
> **************************************************************************************************<br>
> <br>
> _______________________________________________<br>
> QGIS-Developer mailing list<br>
> <a href="mailto:QGIS-Developer@lists.osgeo.org" target="_blank">QGIS-Developer@lists.osgeo.org</a><br>
> List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
> Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
> <br>
<br>
_______________________________________________<br>
QGIS-Developer mailing list<br>
<a href="mailto:QGIS-Developer@lists.osgeo.org" target="_blank">QGIS-Developer@lists.osgeo.org</a><br>
List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a></blockquote></div>