[gdal-dev] Does gdal_calc.py not calculate arithmetic with in the same file?

2014-07-29 Thread Cleo Drakos
Hi GDAL Developers, I have one GeoTIFF file with 2 bands. The data type is Byte. I want to calculate (Band2-Band1)/(Band2+Band1). But the following command provided a dark image: gdal_calc.py -A infile --A_band 1 -B infile, --B_band 0 --outfile outfile --calc (A-B)/(A+B) Does gdal_calc.py not

Re: [gdal-dev] Does gdal_calc.py not calculate arithmetic with in the same file?

2014-07-29 Thread Etienne Tourigny
I am not sure, but you can do the following to make sure: cp infile infile2 gdal_calc.py -A infile --A_band 1 -B infile2 --B_band 0 --outfile outfile --calc (A-B)/(A+B) Also, perhaps the extra comma in your command might be to blame -B infile, Etienne On Tue, Jul 29, 2014 at 3:46 AM, Cleo

Re: [gdal-dev] Does gdal_calc.py not calculate arithmetic with in the same file?

2014-07-29 Thread Cleo Drakos
Thanks for your response. I tried the followings: gcalc = 'C:\\Users\\cleo\\Documents\\gdalpys\\gdal_calc.py' ##I produced second file (b)as the copy of first(a) a = 'D:\\a.tif' b = 'D:\\b.tif' outfile = 'D:\\result.tif' expr = '(A-B)/(A+B)'

Re: [gdal-dev] Does gdal_calc.py not calculate arithmetic with in the same file?

2014-07-29 Thread Vincent Schut
On 07/29/2014 04:04 PM, Cleo Drakos wrote: Thanks for your response. I tried the followings: gcalc = 'C:\\Users\\cleo\\Documents\\gdalpys\\gdal_calc.py' ##I produced second file (b)as the copy of first(a) a = 'D:\\a.tif' b = 'D:\\b.tif' outfile = 'D:\\result.tif' expr = '(A-B)/(A+B)'

Re: [gdal-dev] Does gdal_calc.py not calculate arithmetic with in the same file?

2014-07-29 Thread Jukka Rahkonen
Cleo Drakos cleo21drakos at gmail.com writes: Thanks for your response.I tried the followings: gcalc = 'C:\\Users\\cleo\\Documents\\gdalpys\\gdal_calc.py' ##I produced second file (b)as the copy of first(a) a = 'D:\\a.tif' b = 'D:\\b.tif' outfile = 'D:\\result.tif' expr =

[gdal-dev] ESRI Shapefile Driver Not Found

2014-07-29 Thread Michael Aschenbeck
Hello, I'm having trouble creating a shapefile. My problems are isolated to the following c++ block: const char *pszDriverName = ESRI Shapefile; GDALDriver *poDriver; GDALAllRegister(); poDriver = GetGDALDriverManager()-GetDriverByName(pszDriverName ); if( poDriver == NULL )

Re: [gdal-dev] ESRI Shapefile Driver Not Found

2014-07-29 Thread Kyle Shannon
On Tue, Jul 29, 2014 at 1:46 PM, Michael Aschenbeck m.g.aschenb...@gmail.com wrote: Hello, I'm having trouble creating a shapefile. My problems are isolated to the following c++ block: const char *pszDriverName = ESRI Shapefile; GDALDriver *poDriver; GDALAllRegister();

Re: [gdal-dev] ESRI Shapefile Driver Not Found

2014-07-29 Thread Michael Aschenbeck
Thank you, I was following the tutorial for the newest version while I was on a 1.1x version. The links you supplied helped! On Tue, Jul 29, 2014 at 2:21 PM, Kyle Shannon k...@pobox.com wrote: On Tue, Jul 29, 2014 at 1:46 PM, Michael Aschenbeck m.g.aschenb...@gmail.com wrote: Hello,

Re: [gdal-dev] Does gdal_calc.py not calculate arithmetic with in the same file?

2014-07-29 Thread Cleo Drakos
yes, I checked the histogram and the out image is completely black. cleo On Wed, Jul 30, 2014 at 1:53 AM, Jukka Rahkonen jukka.rahko...@mmmtike.fi wrote: Cleo Drakos cleo21drakos at gmail.com writes: Thanks for your response.I tried the followings: gcalc =

Re: [gdal-dev] Does gdal_calc.py not calculate arithmetic with in the same file?

2014-07-29 Thread Cleo Drakos
Even if I converted the input file into Float 32 at first, the resulted image is still totally black. cleo On Tue, Jul 29, 2014 at 11:20 PM, Vincent Schut sc...@sarvision.nl wrote: On 07/29/2014 04:04 PM, Cleo Drakos wrote: Thanks for your response. I tried the followings: gcalc =

Re: [gdal-dev] Does gdal_calc.py not calculate arithmetic with in the same file?

2014-07-29 Thread Jeremy Palmer
Hi Cleo, Just been dealing with this type of issue. It’s likely that the byte datatype is overflowing. Try something like: --calc (A.astype(int)-B.astype(int))/(A.astype(int)+B.astype(int)) Actually you might only need to cast one of the bands from byte to int, so the syntax could be:

Re: [gdal-dev] Does gdal_calc.py not calculate arithmetic with in the same file?

2014-07-29 Thread Cleo Drakos
Hello Jeremy Thanks for your response. I am still getting the completely black image. The input image I am working with is here: http://commondatastorage.googleapis.com/earthenginepartners-hansen/GFC2013/Hansen_GFC2013_last_00N_000E.tif cleo On Wed, Jul 30, 2014 at 11:15 AM, Jeremy

[gdal-dev] The documentation should be corrected, I think.

2014-07-29 Thread Cleo Drakos
Dear all: The problem I was facing has been solved. I detected that the problem was with the band number '0'. Solution is: the band number starts from '1'. But, the gdal documentation says that the default band number is '0'. http://www.gdal.org/gdal_calc.html The documentation should be

Re: [gdal-dev] Does gdal_calc.py not calculate arithmetic with in the same file?

2014-07-29 Thread Cleo Drakos
Hi Jeremy Your idea is grateful. The following code worked for me: --calc (A.astype(float32)-B A.astype(float32)+B) cleo On Wed, Jul 30, 2014 at 11:15 AM, Jeremy Palmer jpal...@linz.govt.nz wrote: Hi Cleo, Just been dealing with this type of issue. It’s likely that the byte

[gdal-dev] styles .ofs and OGR_STBL_GetNextStyle()

2014-07-29 Thread Nik Sands
Hi Devs, I'm just planning to convert my own 'in-house' drawing styles management to using the styles management built into OGR. The documentation at http://www.gdal.org/ogr_feature_style.html suggests that styles can be in a '.ofs' file to be automatically associated with a data source of