<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, May 2, 2016 at 3:27 PM, Even Rouault <span dir="ltr"><<a href="mailto:even.rouault@spatialys.com" target="_blank">even.rouault@spatialys.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class="">Le lundi 02 mai 2016 15:16:30, Daniele Romagnoli a écrit :<br>
> Hi Even,<br>
> The produced GeoTIFF doesn't contain any nodata metadata/flag/TAG.<br>
> It simply has "NaN" pixels. QuantumGIS report those pixels as "nan" and<br>
> OpenEV report them as 1.#QNAN so I think they are properly "recognized" as<br>
> NaN.<br>
><br>
> I'm wondering if the GDAL utilities explicitly look for some metadata/flag<br>
> (as the "nodata value" in your previous ascii based sample) to do noData<br>
> checks or if it's also able to recognize a NaN "binary" value inside the<br>
> pixels.<br>
<br>
</span>Yes, the NaN value must be explicitly set as the nodata property of the geotiff<br>
file so that gdalbuildvrt can recognize it as the nodata value (similarly to<br>
other nodata value)<br>
<br>
You can do this with gdal_translate -a_nodata nan (or gdal_edit.py -a_nodata<br>
nan)<br></blockquote><div><br></div><div>Ok. Thanks.</div><div>I was trying to add it with "gdalbuildvrt -srcnodata nan" to avoid an intermediate step between my geotiff and the VRT but I was getting:</div><div>ERROR 5: Invalid -srcnodata value<br></div><div><br></div><div>Therefore, I had to edit the VRT by replacing the <ComplexSource><NODATA>-9999</NODATA></ComplexSource> with "nan" instead of "-9999".</div><div>Do you know if there is any chance to let the -srcnodata parameter accept a String like "nan"?</div><div><br></div><div>Cheers,</div><div>Daniele</div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div><div class="h5"><br>
><br>
> What do you think about it?<br>
> Cheers,<br>
> Daniele<br>
><br>
> On Mon, May 2, 2016 at 2:52 PM, Daniele Romagnoli <<br>
><br>
> <a href="mailto:daniele.romagnoli@geo-solutions.it">daniele.romagnoli@geo-solutions.it</a>> wrote:<br>
> > Hi Even.<br>
> > Thanks for the feedback.<br>
> ><br>
> > Sorry... I'm using GDAL 1.11.3.<br>
> > I'm going to double check to make sure I didn't make any mistake.<br>
> > I'll let you know.<br>
> ><br>
> > Cheers,<br>
> > Daniele<br>
> ><br>
> ><br>
> ><br>
> > On Mon, May 2, 2016 at 2:49 PM, Even Rouault <<a href="mailto:even.rouault@spatialys.com">even.rouault@spatialys.com</a>><br>
> ><br>
> > wrote:<br>
> >> Le lundi 02 mai 2016 14:37:39, Daniele Romagnoli a écrit :<br>
> >> > Hi List,<br>
> >> ><br>
> >> > I have a reprojectiion tool which creates GeoTIFFs with NoData = NaN.<br>
> >> > I'm creating couple of GeoTIFFs with partially overlapping areas where<br>
> >> > GeoTIFF1 has NaNs in a region and GeoTIFF2 has proper values in the<br>
> >> > same overlapping region and viceversa (GeoTIFF2 has some NaN area<br>
> >> > while<br>
> >><br>
> >> GeoTIFF1<br>
> >><br>
> >> > has valid pixels for same area).<br>
> >> > I have built a VRT on top of them and then translated into a single<br>
> >> > GeoTIFF. However, the result has NaN in those regions.<br>
> >> > I was hoping that the area containing NaNs would have been ignored<br>
> >><br>
> >> instead,<br>
> >><br>
> >> > in favor of proper values from the other file.<br>
> >> > Is there any flag, properties or suggestions to make it working?<br>
> >> ><br>
> >> > If I configure the reprojection tool to write NoData = -9999 and then<br>
> >><br>
> >> use<br>
> >><br>
> >> > gdalbuildvrt -srcnodata -9999, things are working fine.<br>
> >> > So I'm just wondering if the same can be achieved dealing with NaN<br>
> >><br>
> >> instead<br>
> >><br>
> >> > of custom values.<br>
> >><br>
> >> Daniele,<br>
> >><br>
> >> You didn't mention which GDAL version you use. It is possible that<br>
> >> support for<br>
> >> NaN as a nodata value in gdalbuildvrt & the VRT driver was fixed at some<br>
> >> point.<br>
> >> From a quick test with trunk, it works (works with 1.11 branch as<br>
> >> well):<br>
> >><br>
> >> $ cat in1.asc<br>
> >> ncols 3<br>
> >> nrows 3<br>
> >> xllcorner 440720.000000000000<br>
> >> yllcorner 3750120.000000000000<br>
> >> cellsize 60.000000000000<br>
> >> NODATA_value nan<br>
> >><br>
> >> 1.0 1.0 1.0<br>
> >> 1.0 nan 1.0<br>
> >> 1.0 1.0 1.0<br>
> >><br>
> >> $ cat in2.asc<br>
> >> ncols 3<br>
> >> nrows 3<br>
> >> xllcorner 440720.000000000000<br>
> >> yllcorner 3750120.000000000000<br>
> >> cellsize 60.000000000000<br>
> >> NODATA_value nan<br>
> >><br>
> >> nan nan nan<br>
> >> nan 2.0 nan<br>
> >> nan nan nan<br>
> >><br>
> >> $ gdalbuildvrt nan.vrt in1.asc in2.asc<br>
> >><br>
> >> $ gdal_translate nan.vrt /vsistdout/ -of aaigrid<br>
> >> ncols 3<br>
> >> nrows 3<br>
> >> xllcorner 440720.000000000000<br>
> >> yllcorner 3750120.000000000000<br>
> >> cellsize 60.000000000000<br>
> >> NODATA_value nan<br>
> >><br>
> >> 1 1 1<br>
> >> 1 2 1<br>
> >> 1 1 1<br>
> >><br>
> >> Even<br>
> >><br>
> >> --<br>
> >> Spatialys - Geospatial professional services<br>
> >> <a href="http://www.spatialys.com" rel="noreferrer" target="_blank">http://www.spatialys.com</a><br>
> ><br>
> > --<br>
> > ==<br>
> > GeoServer Professional Services from the experts! Visit<br>
> > <a href="http://goo.gl/it488V" rel="noreferrer" target="_blank">http://goo.gl/it488V</a> for more information.<br>
> > ==<br>
> ><br>
> > Ing. Daniele Romagnoli<br>
> > Senior Software Engineer<br>
> ><br>
> > GeoSolutions S.A.S.<br>
> > Via di Montramito 3/A<br>
> > 55054 Massarosa (LU)<br>
> > Italy<br>
> > phone: <a href="tel:%2B39%200584%20962313" value="+390584962313">+39 0584 962313</a><br>
> > fax: <a href="tel:%2B39%200584%201660272" value="+3905841660272">+39 0584 1660272</a><br>
> ><br>
> > <a href="http://www.geo-solutions.it" rel="noreferrer" target="_blank">http://www.geo-solutions.it</a><br>
> > <a href="http://twitter.com/geosolutions_it" rel="noreferrer" target="_blank">http://twitter.com/geosolutions_it</a><br>
> ><br>
> > -------------------------------------------------------<br>
> ><br>
</div></div>> > *AVVERTENZE AI SENSI DEL D.Lgs. 196/2003*<br>
<div class=""><div class="h5">> ><br>
> > Le informazioni contenute in questo messaggio di posta elettronica e/o<br>
> > nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il<br>
> > loro utilizzo è consentito esclusivamente al destinatario del messaggio,<br>
> > per le finalità indicate nel messaggio stesso. Qualora riceviate questo<br>
> > messaggio senza esserne il destinatario, Vi preghiamo cortesemente di<br>
> > darcene notizia via e-mail e di procedere alla distruzione del messaggio<br>
> > stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso,<br>
> > divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od<br>
> > utilizzarlo per finalità diverse, costituisce comportamento contrario ai<br>
> > principi dettati dal D.Lgs. 196/2003.<br>
> ><br>
> ><br>
> ><br>
> > The information in this message and/or attachments, is intended solely<br>
> > for the attention and use of the named addressee(s) and may be<br>
> > confidential or proprietary in nature or covered by the provisions of<br>
> > privacy act (Legislative Decree June, 30 2003, no.196 - Italy's New Data<br>
> > Protection Code).Any use not in accord with its purpose, any disclosure,<br>
> > reproduction, copying, distribution, or either dissemination, either<br>
> > whole or partial, is strictly forbidden except previous formal approval<br>
> > of the named<br>
> > addressee(s). If you are not the intended recipient, please contact<br>
> > immediately the sender by telephone, fax or e-mail and delete the<br>
> > information in this message that has been received in error. The sender<br>
> > does not give any warranty or accept liability as the content, accuracy<br>
> > or completeness of sent messages and accepts no responsibility for<br>
> > changes made after they were sent or for other risks which arise as a<br>
> > result of e-mail transmission, viruses, etc.<br>
<br>
--<br>
</div></div><div class=""><div class="h5">Spatialys - Geospatial professional services<br>
<a href="http://www.spatialys.com" rel="noreferrer" target="_blank">http://www.spatialys.com</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><span style="font-size:12.8px">==</span><br></div><div dir="ltr"><span style="font-size:12.8px">GeoServer Professional Services from the experts! Visit</span><br style="font-size:12.8px"><a href="http://goo.gl/it488V" style="color:rgb(17,85,204);font-size:12.8px" target="_blank">http://goo.gl/it488V</a><span style="font-size:12.8px"> for more information.</span><br>
==<br>
<br>Ing. Daniele Romagnoli<br>Senior Software Engineer<br><br>GeoSolutions S.A.S.<br><span style="font-size:12.8px">Via di Montramito 3/A</span><br>55054 Massarosa (LU)<br>Italy<br>phone: +39 0584 962313<br>fax: +39 0584 1660272<br><br><a href="http://www.geo-solutions.it" target="_blank">http://www.geo-solutions.it</a><br><a href="http://twitter.com/geosolutions_it" target="_blank">http://twitter.com/geosolutions_it</a><br><br>-------------------------------------------------------<br><p><span lang="IT"><font size="1"><b>AVVERTENZE AI SENSI DEL D.Lgs. 196/2003</b></font></span></p><p><span lang="IT"><font size="1">Le
informazioni contenute in questo messaggio di posta elettronica e/o
nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il
loro utilizzo è consentito esclusivamente al destinatario del messaggio,
per le finalità indicate nel messaggio stesso. Qualora riceviate questo
messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
darcene notizia via e-mail e di procedere alla distruzione del messaggio
stesso, cancellandolo dal Vostro sistema. Conservare il messaggio
stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti,
copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento
contrario ai principi dettati dal D.Lgs. 196/2003.</font></span></p><p><span lang="IT"><font size="1"> </font></span></p><p><font size="1">The
information in this message and/or attachments, is intended solely for
the attention and use of the named addressee(s) and may be confidential
or proprietary in nature or covered by the provisions of privacy act
(Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection
Code).Any use not in accord with its purpose, any disclosure,
reproduction, copying, distribution, or either dissemination, either
whole or partial, is strictly forbidden except previous formal approval
of the named addressee(s). If you are not the intended recipient, please
contact immediately the sender by telephone, fax or e-mail and delete
the information in this message that has been received in error. The
sender does not give any warranty or accept liability as the content,
accuracy or completeness of sent messages and accepts no responsibility
for changes made after they were sent or for other risks which arise as
a result of e-mail transmission, viruses, etc.</font></p><br></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
</div></div>