[gdal-dev] How to use -dstnodata in gdalwarp

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[gdal-dev] How to use -dstnodata in gdalwarp

sunil.chaudhary
Can someone give me the correct syntax on how to use -dstnodata in gdalwarp?
I'm having an issue where when I'm trying to use this option I'm getting
some unpredictable outputs

What I am trying to do is set the output no data value as black or 0, so for
my command line I put in the following:

gdalwarp -dstnodata 0 GB_AB_z11_deflate.tif GB_AB_z11_deflate_nodata.tif

For the output what I would expect is that the black pixels would be set to
no data, what I am getting however is whenever the program see's a R value
as 0 it sets it to no data. So if I have a pixel with the value of 0 15 36
it sets the R as no data.

Am I using this parameter incorrectly, or is there a bug in the program?
<http://osgeo-org.1560.x6.nabble.com/file/t382122/no_data1.png>
<http://osgeo-org.1560.x6.nabble.com/file/t382122/no_data2.png>



--
Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html
_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: How to use -dstnodata in gdalwarp

sunil.chaudhary
I have also tried quoting the dstnodata value as "0 0 0" and I got the same
result



--
Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html
_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: How to use -dstnodata in gdalwarp

Even Rouault-2

On lundi 27 novembre 2017 14:38:55 CET sunil.chaudhary wrote:

> I have also tried quoting the dstnodata value as "0 0 0" and I got the same

> result

 

The issue is more likely on the source side.

 

Try adding: -srcnodata "0 0 0"

Or: -wo UNIFIED_SRC_NODATA=YES

 

Even

 

--

Spatialys - Geospatial professional services

http://www.spatialys.com


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: How to use -dstnodata in gdalwarp

sunil.chaudhary
I have tried using -srcnodata 0 but I got the same result.
I don't know about -wo UNIFIED_SRC_NODATA=YES, what exactly does that do?



--
Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html
_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: How to use -dstnodata in gdalwarp

jratike80
sunil.chaudhary wrote
> I have tried using -srcnodata 0 but I got the same result.
> I don't know about -wo UNIFIED_SRC_NODATA=YES, what exactly does that do?

Hi,

Read carefully what Even wrote and try exactly with -srcnodata "0 0 0".
There is a link to warpinp options in http://www.gdal.org/gdalwarp.html, the
link leads to
http://www.gdal.org/structGDALWarpOptions.html#a0ed77f9917bb96c7a9aabd73d4d06e08,
and there you can read about UNIFIES_SRC_NODATA this:

UNIFIED_SRC_NODATA=YES/NO: By default nodata masking values considered
independently for each band. However, sometimes it is desired to treat all
bands as nodata if and only if, all bands match the corresponding nodata
values. To get this behavior set this option to YES. Note:
UNIFIED_SRC_NODATA=YES is set by default, when called from gdalwarp /
GDALWarp()

-Jukka Rahkonen-



--
Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html
_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev