[gdal-dev] GDALOpen GDALClose memory leak when threading

2010-09-30 Thread Benoît Andrieu

 Hi list !

I am having some strange memory leak problems and I need help ! ^^

Our software is having memory leaks, I looked into this and I found it 
is related with the loading unloading of GDALDatasets.
By the way, the software is in C# and Managed C++. The code that calls 
GDAL is in Managed C++.


So, basically, the software is creating one thread for each picture that 
has to be processed.
It seems that as long as all the GDALOpen and GDALClose are made in one 
and only thread then there is no memory leak.
But if the GDAL calls are made in different threads (Managed threads), 
then there are memory leaks.


I looked at the documentation but could not find anything really related 
to this. Am I missing something ?


Thanks for any tips !

Benoît
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev


Re: [gdal-dev] gdalwarp -dstnodata

2010-05-28 Thread Benoît Andrieu

Hi Sven,

It's not the role of gdalwarp to tell the color to be rendered with no 
data values.
In your example, gdalwarp tells the renderer to display the pixels with 
values equal to 255 with a color specified by the renderer.

It only adds in the tif files a tag that set the white color as transparent.

For example, with Mapserver as a renderer, you will set in the mapfile 
the background color as white (IMAGECOLOR 255 255 255).


What software are you using to view your files ?
What is the color in the source file that you want as transparent / white ?

Regards,

Benoît


Le 28/05/2010 11:05, Sven Schroeter a écrit :

Hi,
I use the gdalwarp utility to transform geotifs:

gdalwarp -co compress=lzw -s_srs +proj=tmerc +lat_0=0 +lon_0=6 
+k=1.00

+x_0=250+y_0=0 +ellps=bessel +units=m
+towgs84=590.1181,99.6226,340.1890,1.185095,-1.334952,-2.904521,16.51559 
-t_srs

+proj=utm +ellps=GRS80 +datum=WGS84 +zone=32 -dstnodata 255
bbp07231053_2559-wla_0053-1a.tif out/bbp07231053_2559-wla_0053-1a.tif

I want to convert the new nodata-areas to be displayed in white (255 
255

255)
if I try -dstnodata 255  or -dstnodata 255 255 255 in every picture 
the no

data areas have other colors but not white. What can I do?

Thanks
Sven


___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

[Gdal-dev] VRT format Schema

2010-02-28 Thread Benoît Andrieu

Hi list !

I need to merge three tif files, each one having a single Float32 band.
I want each file to use a separated band of the final tif.

I think the best way to do this is to use the VRT driver.
I would have liked to not use the C# binding or the native C++ library.
I would prefer to create a file on the disk using C# serialization.

I am so searching for the schema of the VRT format and I've found this quite 
old thread.
I saw the XSD in one of the messages of the topic. Is it correct ?
It is mentionned too that the XSD should be in the CVS/SVN in gdal/frmts/vrt 
but I've not found it, I assume the idea has been abandonned.

I am also interested in any other suggestion ! ^^

Thanks in advance.

Regards,
Benoit Andrieu


Antoine Hue wrote:

/  There are still a few dark zones and area to improves:

//  - ComplexSource and AverageSource need a complete definition
//  Any information about these sources? They do not appear in the VRT tut
//  and I did not get there purpose/functioning.
//  - Better definition of the subClass property of the VRTRasterBand
//  needed.
//
//  What did you need to know?  It seems that values include
//  VRTWarpedDataset,
//  VRTDerivedRasterBand and VRTRawRasterBand.
//  OK, I will add this. What is the impact this parameter on the VRT
//  processing?
/
Antoine,

It determines what elements are legal on the VRTRasterBand and
internally it tells GDAL which particular class to instantiate.
This subClass attribute approach does not really lend itself to
describing the grammar with XML schema as far as I know.


/  - An explicit definition of the raw raster source (to go with

//  SimpleSource, KernelFilteredSource,..) would improve homogeneity.
//
//  I'm not sure what you mean. Isn't the .vrt Descriptions for Raw Files
//  on the gdal_vrttut.html page appropriate?
/  

/  For example, Simple source are described in theSimpleSource  tag.

//  However, there is noRawRasterSource   tag but a set of tags specific
//  to the raw raster band (VRTRasterBand subClass=VRTRawRasterBand)
/
That is correct, there is no RawRasterSource or equivelent.  Raw, warped
and derived data can only be implemented as complete bands, not sources
on a sourced band.


/  This actually appears in the schema:

//
//  !-- Raster Band --
//  xsd:complexType name=vrt_raster_band_t
//  
//  xsd:choice maxOccurs=unbounded
//  xsd:element name=SimpleSource type=simple_source_t /
//  xsd:element name=KernelFilteredSource
//  type=kernel_source_t /
//  xsd:element name=ComplexSource /  !-- Need refinement --
//  xsd:element name=AveragedSource /  !-- Need refinement --
//  xsd:sequence
//  !-- Raw source --
//  xsd:element name=SourceFilename
//  type=source_file_name_t/
//  xsd:element name=ImageOffset
//  type=xsd:nonNegativeInteger /
//  xsd:element name=PixelOffset
//  type=xsd:nonNegativeInteger /
//  xsd:element name=LineOffset
//  type=xsd:nonNegativeInteger /
//  xsd:element name=ByteOrder type=byte_order_t /
//  /xsd:sequence
//  /xsd:choice...
//  /xsd:complexType
//
//  One more question about it, the extract above allows mixed type sources
//  within a raster band. Is this correct?
/
A sourced raster band (the default kind of VRTRasterBand) can have
a mixture of different sources.


/  Were you thinking of the .xsd file as being primarily useful for

//  automated validation of .vrt files?  As educational?
//  Why not both?
//  Schema is more extensive than the tutorial and more readable than C++.
//  It may also simplify C++ by checking validity of the VRT in place of the
//  C++.
/
As I mention, I think I have approached the .vrt files in a way that is
not conveniently expressed in XML Schema and I would contend that the
schema files are not all that readable as a description.


/  Schema may also make it possible to version VRT grammar and enable

//  evolution of the format.
/
Well, keep in mind that the code is using a schema supporting parser
of any kind, so the .xsd files aren't systematically useful to GDAL
itself.  As for versioning, I anticipate handling this in an adhoc
fashion, primarily by just extending the format rather than changing
existing items.

Best regards,
--
---+--
I set the clouds in motion - turn up   | Frank Warmerdam,warmerdam at pobox.com  
http://lists.osgeo.org/mailman/listinfo/gdal-dev
light and sound - activate the windows |http://pobox.com/~warmerdam  
http://pobox.com/%7Ewarmerdam
and watch the world go round - Rush| President OSGF,http://osgeo.org

___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Re: Re :Re: Re :Re: [gdal-dev] How to use GDAL Library

2009-03-30 Thread Benoît Andrieu
Well...

Have you checked your path to your include files ?
Could I see the part of the code where the errors occured ?

Thx

Benoît Andrieu
b...@ixsea.com
benoit.andr...@gmail.com

  - Original Message - 
  From: Ajmeri Iqbal 
  To: b...@ixsea.com 
  Cc: gdal-dev@lists.osgeo.org 
  Sent: Monday, March 30, 2009 3:22 PM
  Subject: Re :Re: Re :Re: Re :Re: [gdal-dev] How to use GDAL Library


  Hi,

  Thanks Benoît Andrieubea for your reply.
  you are right, there is no need any cpp file. but when i build the same code 
given in GDAL tutorial with QT Creator popups the following error.

  g++ -enable-stdcall-fixup -Wl,-enable-auto-import 
-Wl,-enable-runtime-pseudo-reloc -Wl,-subsystem,console -mthreads -Wl -o 
debugImageRW.exe debug/main.o -Ld:Qt2009.01qtlib gdal_i.lib -lQtCored4
  mingw32-make[1]: Leaving directory `D:/QT_Projects/ImageRW'

  mingw32-make: Leaving directory `D:/QT_Projects/ImageRW'

  debug/main.o: In function `main':

  D:/QT_Projects/ImageRW/main.cpp:34: undefined reference to 
`GDALDataset::GetRasterCount()'

  D:/QT_Projects/ImageRW/main.cpp:34: undefined reference to 
`GDALDataset::GetRasterYSize()'

  D:/QT_Projects/ImageRW/main.cpp:34: undefined reference to 
`GDALDataset::GetRasterXSize()'

  collect2: ld returned 1 exit status

  mingw32-make[1]: *** [debugImageRW.exe] Error 1

  mingw32-make: *** [debug] Error 2

  Exited with code 2.


  but the same code i builded with VC++ 2005, its working fine.

  unfortunatly i want to link GDAL library in QT.

  the bellow is my QT .pro file setting

  QT -= gui

  TARGET = ImageRW

  CONFIG += console

  CONFIG -= app_bundle

  TEMPLATE = app

  SOURCES += main.cpp

  LIBS += gdal_i.lib

  thanks in advance.



  On Mon, 30 Mar 2009 14:42:07 +0200 Benoît Andrieu wrote







  Hi !
   
  You won't need any cpp files.
  Personally, I am using the FWTools package which 
  bundles dll, libs and headers files.
   
  You just have to compile using gdal_priv.h
  Then link to gdal_i.lib
  Then provide with your runtime all the dlls 
  which gdal_fw.dll is depending to.
  You will find which dlls it is depending to by 
  using Dependency Walker (http://www.dependencywalker.com/).
   
  Then your runtime will be able to use all of the 
  image formats drivers that GDAL was compiled to support.
   
  I hope this will help.
   
  Regards,
   
  Benoît andrieu...@ixsea.combenoit.andrieu@gmail.com

  - Original Message - 
  From: 
  Ajmeri 
  Iqbal 
  To: b...@ixsea.com 
  Cc: gdal-dev@lists.osgeo.org 
  Sent: Monday, March 30, 2009 11:06 
  AM
  Subject: Re :Re: Re :Re: [gdal-dev] How 
  to use GDAL Library

  Hi,Actually i m working on Generic image reading/writing and 
  display on viewer with all of its information, so i think i need all listed 
  library. but dont know how to use them in my code.
  i have downloded gdal_i.lib, gdal.dll and its include .h files..h files 
  contains only the prototype function to link with library but i could not 
find 
  its .cpp file which may containt implementation function of that linking 
  function of .h files.
  can u please give me broad idea or step by step procedure about how do i 
  link these library to c++ code.
  thanks in advanceRegards,IqbalOn Fri, 27 Mar 2009 18:54:01 
  +0100 Benoît Andrieu wroteHi, I 
  am using FWTools 2.2.9So I am releasing my softwares with most of the 
  dlls (you can use depends to find which). The linking is 
  done with 
  :gdal_i.libgeos_i.libgeotiff_i.liblibtiff_i.libproj_i.lib But 
  yo may want to use more or less 
  libraries... Regards, Benoît 
  andrieu...@ixsea.combenoit.andrieu@gmail.com- Original Message 
  - From: Ajmeri Iqbal To: b...@ixsea.com Cc: 
  gdal-dev@lists.osgeo.org Sent: Friday, March 27, 2009 3:11 
  PMSubject: Re :Re: [gdal-dev] How to use GDAL LibraryHi Benoît 
  Andrieu,Thanks for reply.i already saw that tutorial,but the problame is 
  how to and which library to be linked using QT(most probably same way of 
  C/C++).coz there is a three library named gdal16.dll, gdal_i.lib and 
  gdal.lib.On Fri, 27 Mar 2009 11:33:42 +0100 Benoît Andrieu 
  wroteHi, If you want to use GDAL in C / C++, take a look at the 
  tutorial at http://www.gdal.org/gdal_tutorial.html.It is really 
  straightforward, I used this for the integration of GDAL in our modules 
  and it worked fine. Regards, Benoît 
  andrieu...@ixsea.combenoit.andrieu@gmail.com- Original Message 
  - From: Ajmeri Iqbal To: gdal-dev@lists.osgeo.org Sent: Friday, 
  March 27, 2009 11:06 AMSubject: [gdal-dev] How to use GDAL LibraryDear 
  all,I want to use GDAL library in my project using QT.How could i use this 
  library for Reading and writing the Raster images (i.e. 
  JPEG,JPEG200,TIFF,GeoTiff,BMP,PNG,GIF, etc)please help me.Thanks in 
  advance___gdal-dev mailing 
  listgdal-...@lists.osgeo.orghttp://lists.osgeo.org/mailman/listinfo/gdal-dev








   
___
gdal-dev

[gdal-dev] Availability of Lanczos and cubicspline in gdaladdo

2009-03-30 Thread Benoît Andrieu

Hi list !

I was wondering why the Lanczos and cubicspline are available in gdal_warp and 
not gdaladdo ?

The quality after downsizing images with gdalwarp is so perfect that I am now 
willing to include this in my overviews.
Is there any chances to have this include in future releases or is there any 
difficulties I am not aware of ?

Benoît Andrieu
b...@ixsea.com
benoit.andr...@gmail.com

___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev


Re: [gdal-dev] How to use GDAL Library

2009-03-27 Thread Benoît Andrieu
Hi,

If you want to use GDAL in C / C++, take a look at the tutorial at 
http://www.gdal.org/gdal_tutorial.html.
It is really straightforward, I used this for the integration of GDAL in our 
modules and it worked fine.

Regards,

Benoît Andrieu
b...@ixsea.com
benoit.andr...@gmail.com

  - Original Message - 
  From: Ajmeri Iqbal 
  To: gdal-dev@lists.osgeo.org 
  Sent: Friday, March 27, 2009 11:06 AM
  Subject: [gdal-dev] How to use GDAL Library


  Dear all,
  I want to use GDAL library in my project using QT.
  How could i use this library for Reading and writing the Raster images (i.e. 
JPEG,JPEG200,TIFF,GeoTiff,BMP,PNG,GIF, etc)

  please help me.

  Thanks in advance

   



--


  ___
  gdal-dev mailing list
  gdal-dev@lists.osgeo.org
  http://lists.osgeo.org/mailman/listinfo/gdal-dev___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

[gdal-dev] Overview building broken

2008-12-10 Thread Benoît Andrieu

Hi all !

I am using FWTools 2.2.6 and have some problems with the overview 
building...

I just tried the 2.2.8 release, same result !

My software tries to build a x level overview pyramid on a GTiff.
I am using the following code :

CPLErr statut_generation_pyramidage = 
gdal_dataset_copie-BuildOverviews(average, nb_pyramidage, anOverviewList, 
0, NULL, NULL, NULL);


The function is returning CE_Failure and the console has a lot of messages 
which appears on the call of the BuildOverviews' method.


ERROR 1: TIFFSetField:f:\test_isdas\PIC_CONT_SS_F_4_8bit.TIF: Cannot modify 
tag Compression while writing
ERROR 1: TIFFSetField:f:\test_isdas\PIC_CONT_SS_F_4_8bit.TIF: Cannot modify 
tag ImageWidth while writing
ERROR 1: TIFFSetField:f:\test_isdas\PIC_CONT_SS_F_4_8bit.TIF: Cannot modify 
tag PlanarConfiguration while writing
ERROR 1: TIFFSetField:f:\test_isdas\PIC_CONT_SS_F_4_8bit.TIF: Cannot modify 
tag BitsPerSample while writing
ERROR 1: TIFFSetField:f:\test_isdas\PIC_CONT_SS_F_4_8bit.TIF: Cannot modify 
tag SamplesPerPixel while writing
ERROR 1: TIFFSetField:f:\test_isdas\PIC_CONT_SS_F_4_8bit.TIF: Cannot modify 
tag Compression while writing
ERROR 1: TIFFSetField:f:\test_isdas\PIC_CONT_SS_F_4_8bit.TIF: Cannot modify 
tag PhotometricInterpretation while writing
ERROR 1: TIFFSetField:f:\test_isdas\PIC_CONT_SS_F_4_8bit.TIF: Cannot modify 
tag SampleFormat while writing
ERROR 1: TIFFSetField:f:\test_isdas\PIC_CONT_SS_F_4_8bit.TIF: Cannot modify 
tag TileWidth while writing
ERROR 1: TIFFSetField:f:\test_isdas\PIC_CONT_SS_F_4_8bit.TIF: Cannot modify 
tag TileLength while writing

ERROR 1: GTIFFWriteDirectory:Can not write tiles to a stripped image

The complete call sequence is (without some instanciations) :

 GDALDataset* gdal_dataset_copie = poDriver-CreateCopy(string_fileOut, 
gdal_dataset, TRUE, options_, NULL, NULL);

 char **options = 0;
 GDALDriver *gdal_driver = GetGDALDriverManager()-GetDriverByName(MEM);
 GDALDataset* gdal_dataset = gdal_driver-Create(, image-Get_Largeur(), 
image-Get_Hauteur(), nbCanaux, depth, options);

 gdal_dataset-FlushCache();
 gdal_dataset-GetRasterBand(1)-SetColorInterpretation(GCI_GrayIndex);
 //
 // Filling the dataset with data
 //
 gdal_dataset-FlushCache();
 GDALDriver *poDriver = GetGDALDriverManager()-GetDriverByName(GTIFF);
 char **options_ = 0;
 options_ = CSLSetNameValue( options, INTERLEAVE, PIXEL );
 gdal_dataset-SetProjection( string_WKT );
 gdal_dataset-SetGeoTransform( m_P_D_TFW );
 GDALDataset* gdal_dataset_copie = poDriver-CreateCopy(string_fileOut,
gdal_dataset, TRUE, options_, NULL, NULL);
 gdal_dataset_copie-FlushCache();
 CPLErr statut_generation_pyramidage = 
gdal_dataset_copie-BuildOverviews(average, nb_pyramidage, anOverviewList, 
0, NULL, NULL, NULL);

 
gdal_dataset_copie-GetRasterBand(index_band)-SetColorInterpretation(poBand-GetColorInterpretation());
 gdal_dataset_copie-FlushCache();
 delete gdal_dataset_copie;
 delete gdal_dataset;

This code was working with FWTools 1.3.2. I don't know what to do now... I 
don't want to close the dataset, reopen it, build overview, close the 
dataset because of the loss of performance (which is really important).


Any idea ?

Thanks in advance !

Best regards,

Benoît Andrieu
+33.(0)1.30.08.95.21
[EMAIL PROTECTED]

___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev