[gdal-dev] Problem with GDALDatasetRasterIO.cs and ECW files
The value of pixelFormat is Format24bppRGB Here is the code that I use, but I cannot load into a Bitmap. Maybe I don't undesrtand really how to translate the datasource into a bitmap. Public Sub GuardarBitmap(ByRef bmp As Bitmap, ds As Dataset, xOff As Integer, yOff As Integer, width As Integer, height As Integer, _ imageWidth As Integer, imageHeight As Integer) Dim bands As Integer() = New Integer(3) {1, 1, 1, 1}Dim alpha As Boolean = FalseDim index As Boolean = FalseDim numChannels As Integer = 1Dim channelSize As Integer = 8Dim ctable As ColorTable = Nothing For i As Integer = 0 To ds.RasterCount - 1Dim band As Band = ds.GetRasterBand(i + 1)If Gdal.GetDataTypeSize(band.DataType) 8 ThenchannelSize = 16End IfSelect Case band.GetRasterColorInterpretation()Case ColorInterp.GCI_AlphaBandnumChannels = 4 alpha = Truebands(3) = i + 1Exit Select Case ColorInterp.GCI_BlueBandIf numChannels 3 ThennumChannels = 3End If bands(0) = i + 1Exit Select Case ColorInterp.GCI_RedBandIf numChannels 3 Then numChannels = 3End If bands(2) = i + 1Exit SelectCase ColorInterp.GCI_GreenBandIf numChannels 3 Then numChannels = 3End If bands(1) = i + 1Exit SelectCase ColorInterp.GCI_PaletteIndexctable = band.GetRasterColorTable()index = True bands(0) = i + 1Exit SelectCase ColorInterp.GCI_GrayIndexindex = True bands(0) = i + 1Exit SelectCase Else If i 4 AndAlso bands(i) = 0 ThenIf numChannels i ThennumChannels = i End Ifbands(i) = i + 1End If Exit SelectEnd SelectNext Dim pixelFormat__1 As PixelFormatDim dataType__2 As DataType Dim pixelSpace As Integer If index ThenpixelFormat__1 = PixelFormat.Format8bppIndexed dataType__2 = DataType.GDT_BytepixelSpace = 1 ElseIf numChannels = 1 ThenIf channelSize 8 Then pixelFormat__1 = PixelFormat.Format16bppGrayScale dataType__2 = DataType.GDT_Int16pixelSpace = 2 ElsepixelFormat__1 = PixelFormat.Format24bppRgb numChannels = 3dataType__2 = DataType.GDT_BytepixelSpace = 3End If ElseIf alpha ThenIf channelSize 8 ThenpixelFormat__1 = PixelFormat.Format64bppArgb dataType__2 = DataType.GDT_UInt16 pixelSpace = 8ElsepixelFormat__1 = PixelFormat.Format32bppArgbdataType__2 = DataType.GDT_BytepixelSpace = 4End IfnumChannels = 4ElseIf channelSize 8 ThenpixelFormat__1 = PixelFormat.Format48bppRgbdataType__2 = DataType.GDT_UInt16pixelSpace = 6 ElsepixelFormat__1 = PixelFormat.Format24bppRgb dataType__2 = DataType.GDT_Byte pixelSpace = 3End IfnumChannels = 3 End IfEnd IfEnd If Dim bitmap As New Bitmap(imageWidth, imageHeight, pixelFormat__1) If index ThenIf ctable IsNot Nothing Then Dim iCol As Integer = ctable.GetCount()Dim pal As ColorPalette = bitmap.PaletteFor i As Integer = 0 To iCol - 1 Dim ce As ColorEntry = ctable.GetColorEntry(i) pal.Entries(i) = Color.FromArgb(ce.c4, ce.c1, ce.c2, ce.c3)Next bitmap.Palette = palElseDim pal As ColorPalette = bitmap.PaletteFor i As Integer = 0 To 255 pal.Entries(i) = Color.FromArgb(255, i, i, i)Next bitmap.Palette = palEnd IfEnd If
[gdal-dev] Problem with GDALDatasetRasterIO.cs and ECW files
Using the following code I only can read aproximately 500 x 500 pixels. Dim ecwDS As Dataset = Gdal.Open(C:\h10_1024_1-2.ecw, Access.GA_ReadOnly)Dim banda As Band = ecwDS.GetRasterBand(1) Dim bmp As Bitmap = New Bitmap(ecwDS.RasterXSize, ecwDS.RasterYSize, PixelFormat.Format8bppIndexed)Dim bmpData As BitmapData = bmp.LockBits(New Rectangle(0, 0, ecwDS.RasterXSize, ecwDS.RasterYSize), ImageLockMode.ReadOnly, PixelFormat.Format8bppIndexed)Try Dim pal As ColorPalette = bmp.PaletteFor i As Integer = 0 To 255 pal.Entries(i) = Color.FromArgb(255, i, i, i)Next bmp.Palette = pal Dim stride As Integer = bmpData.StrideDim buf As IntPtr = bmpData.Scan0 banda.ReadRaster(0, 0, ecwDS.RasterXSize, ecwDS.RasterYSize, buf, ecwDS.RasterXSize, _ ecwDS.RasterYSize, DataType.GDT_Byte, 1, stride)Finallybmp.UnlockBits(bmpData)End Try PictureBox1.Image = bmp If I change the ecwDS.RasterXSize and ecwDS.RasterYSize to 500 pixels i can get the rasterband into my picturebox. I obtain a memory exception. Not enough memory! Date: Tue, 19 Apr 2011 16:10:27 +0200 Subject: Re: [gdal-dev] Problem with GDALDatasetRasterIO.cs and ECW files From: szeker...@gmail.com To: gistd...@hotmail.es CC: gdal-dev@lists.osgeo.org Not sure what is the actual value of 'pixelFormat__1' in your program. Best regards, Tamas 2011/4/19 Francisco José Reyes Peralta gistd...@hotmail.es The parameter is not valid is the error that I get.I use an adaptation of the source .cs code in VB.NET. Here is part of the code: Dim pixelFormat As PixelFormat Dim dataType As DataType Dim pixelSpace As Integer If isIndexed Then pixelFormat = PixelFormat.Format8bppIndexed dataType = DataType.GDT_Byte pixelSpace = 1 Else If channelCount = 1 Then If channelSize 8 Then pixelFormat = PixelFormat.Format16bppGrayScale dataType = DataType.GDT_Int16 pixelSpace = 2 Else pixelFormat = PixelFormat.Format24bppRgb channelCount = 3 dataType = DataType.GDT_Byte pixelSpace = 3 End If Else If hasAlpha Then If channelSize 8 Then pixelFormat = PixelFormat.Format64bppArgb dataType = DataType.GDT_UInt16 pixelSpace = 8 Else pixelFormat = PixelFormat.Format32bppArgb dataType = DataType.GDT_Byte pixelSpace = 4 End If channelCount = 4 Else If channelSize 8 Then pixelFormat = PixelFormat.Format48bppRgb dataType = DataType.GDT_UInt16 pixelSpace = 6 Else pixelFormat = PixelFormat.Format24bppRgb dataType = DataType.GDT_Byte pixelSpace = 3 End If channelCount = 3 End If End If End If And the Error is in the following line: Dim bitmap As New Bitmap(imageWidth, imageHeight, pixelFormat__1) Is possible to read the dataset and write to a bitmap or picturebox without save as file? Thanks for your reply. Francisco J. 2011/4/19 Francisco José Reyes Peralta gistdt08 at hotmail.es Dear friends, I'm vieweing the *GDALDatasetRasterIO.cs* from the Csharp samples of GDAL and I'm getting an error in the following line *Bitmap bitmap = new Bitmap(imageWidth, imageHeight, pixelFormat);* In the * pixelFormat* argument. Hi, What is the error message specifically? Best regards, Tamas -- next part -- An HTML attachment was scrubbed... URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20110419/cc8baab2/attachment-0001.html ___ 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
Re: [gdal-dev] Problem with GDALDatasetRasterIO.cs and ECW files
Francisco, I can't tell why you got the Parameter is invalid error. Perhaps you should try some VB.net forums. 2011/4/20 Francisco José Reyes Peralta gistd...@hotmail.es The value of pixelFormat is *Format24bppRGB* **Here is the code that I use, but I cannot load into a Bitmap. Maybe I don't undesrtand really how to translate the datasource into a bitmap. Public Sub GuardarBitmap(ByRef bmp As Bitmap, ds As Dataset, xOff As Integer, yOff As Integer, width As Integer, height As Integer, _ imageWidth As Integer, imageHeight As Integer) Dim bands As Integer() = New Integer(3) {1, 1, 1, 1} Dim alpha As Boolean = False Dim index As Boolean = False Dim numChannels As Integer = 1 Dim channelSize As Integer = 8 Dim ctable As ColorTable = Nothing For i As Integer = 0 To ds.RasterCount - 1 Dim band As Band = ds.GetRasterBand(i + 1) If Gdal.GetDataTypeSize(band.DataType) 8 Then channelSize = 16 End If Select Case band.GetRasterColorInterpretation() Case ColorInterp.GCI_AlphaBand numChannels = 4 alpha = True bands(3) = i + 1 Exit Select Case ColorInterp.GCI_BlueBand If numChannels 3 Then numChannels = 3 End If bands(0) = i + 1 Exit Select Case ColorInterp.GCI_RedBand If numChannels 3 Then numChannels = 3 End If bands(2) = i + 1 Exit Select Case ColorInterp.GCI_GreenBand If numChannels 3 Then numChannels = 3 End If bands(1) = i + 1 Exit Select Case ColorInterp.GCI_PaletteIndex ctable = band.GetRasterColorTable() index = True bands(0) = i + 1 Exit Select Case ColorInterp.GCI_GrayIndex index = True bands(0) = i + 1 Exit Select Case Else If i 4 AndAlso bands(i) = 0 Then If numChannels i Then numChannels = i End If bands(i) = i + 1 End If Exit Select End Select Next Dim pixelFormat__1 As PixelFormat Dim dataType__2 As DataType Dim pixelSpace As Integer If index Then pixelFormat__1 = PixelFormat.Format8bppIndexed dataType__2 = DataType.GDT_Byte pixelSpace = 1 Else If numChannels = 1 Then If channelSize 8 Then pixelFormat__1 = PixelFormat.Format16bppGrayScale dataType__2 = DataType.GDT_Int16 pixelSpace = 2 Else pixelFormat__1 = PixelFormat.Format24bppRgb numChannels = 3 dataType__2 = DataType.GDT_Byte pixelSpace = 3 End If Else If alpha Then If channelSize 8 Then pixelFormat__1 = PixelFormat.Format64bppArgb dataType__2 = DataType.GDT_UInt16 pixelSpace = 8 Else pixelFormat__1 = PixelFormat.Format32bppArgb dataType__2 = DataType.GDT_Byte pixelSpace = 4 End If numChannels = 4 Else If channelSize 8 Then pixelFormat__1 = PixelFormat.Format48bppRgb dataType__2 = DataType.GDT_UInt16 pixelSpace = 6 Else pixelFormat__1 = PixelFormat.Format24bppRgb dataType__2 = DataType.GDT_Byte pixelSpace = 3 End If numChannels = 3 End If End If End If Dim bitmap As New Bitmap(imageWidth, imageHeight, pixelFormat__1) If index Then If ctable IsNot Nothing Then Dim iCol As Integer = ctable.GetCount() Dim pal As ColorPalette = bitmap.Palette For i As Integer = 0 To iCol - 1 Dim ce As ColorEntry = ctable.GetColorEntry(i) pal.Entries(i) = Color.FromArgb(ce.c4,
[gdal-dev] Re: RasterizeLayer using attribute
Jonathan, I didn't quite get what your problem is. Do you get all the pixels set to 255? Also, you should probably check if you really want to burn the id value into the raster. On Wed, Apr 20, 2011 at 4:58 PM, dr_jonathan_b...@hotmail.co.uk wrote: Hi, I read your thread on using gdal.RasterizeLayer() in Python to rasterize vector polygons by attribute. I have the same problem as you did. Can you tell me how you resolved it please? My code is almost identical to yours and my key line is: err = gdal.RasterizeLayer( target_ds, [1], vector_lyr, options = [ATTRIBUTE=id, ALL_TOUCHED=TRUE] ) The rasterize process seems to ignore my options. Like you, I get an output raster with all no-data values set to 255. I get a zero error value. Your insights would be very welcome. Many thanks in advance. Regards Jonathan -- Best regards, Chaitanya kumar CH. /tʃaɪθənjə/ /kʊmɑr/ +91-9494447584 17.2416N 80.1426E ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev
[gdal-dev] Re: dev-version of HDF4
I forgot to say, but I have also tried by specifying the location of HDF4, with similar error: ... checking for SDreaddata in -lmfhdfalt... no checking for SDreaddata in -lmfhdf... no checking for SDreaddata in -lhdf4... no checking for SDreaddata in -lmfhdf... no checking for SDreaddata in -lmfhdf... no configure: error: HDF4 support requested with arg /Users/knutfd/Software/hdf-4.2.5/, but neither hdf4 nor mfhdf lib found ... HDF4 library is there, but somehow configure is not able to detect it. HDF4 is compiled without SLIB, so that should not be the problem. I have also tried with older version of HDF4 (4.2r1), other installation points, and prebuilt binaries. And I compiled with options --disable-fortran --disable-netcdf --with-pic, as suggested on http://osgeo-org.1803224.n2.nabble.com/Error-in-GDAL-compiling-with-HDF4-td3351437.html It has been suggested to use a dev version of HDF4, but I don't know if that would solve this problem? Best regards from Knut-Frode On 19/04/2011 21:51, Nikolaos Hatzopoulos wrote: hdf4 libraries not found that's what the log says :) do a locate libhdf4 to see where the library is On Tue, Apr 19, 2011 at 10:24 AM, Knut-Frode Dagestad knutfrodesop...@hotmail.com mailto:knutfrodesop...@hotmail.com wrote: I am trying to compile GDAL from source with support for HDF4 with: ./configure --with-hdf4 but get complaints about missing libraries, see extract from config.log: ld: library not found for -lmfhdfalt ... ld: library not found for -lmfhdf ... ld: library not found for -lhdf4 ... ld: library not found for -lmfhdf configure:19940: checking for SDreaddata in -lmfhdf configure:19965: gcc -o conftest -g -O2 conftest.c -lmfhdf -ldf -lsz -ljpeg -lz -lz -lpthread -ldl 5 ld: library not found for -lmfhdf configure:20009: error: HDF4 support requested with arg yes, but neither hdf4 nor mfhdf lib found Similar errors are also reported by others, e.g. this one using mapserver: http://osgeo-org.1803224.n2.nabble.com/cannot-find-lmfhdf-td5286909.html I have tried with various versions of HDF4, both binaries and compiled from source. The link above (and also http://trac.osgeo.org/gdal/wiki/BuildingOnUnix) suggests to try a hdf-dev version. But where can I find such dev-versions, in my case for Mac OS X 10.6.7? Would it be possible to update GDAL to work with standard HDF4 libraries? Best regards from Knut-Frode ___ gdal-dev mailing list gdal-dev@lists.osgeo.org mailto: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 mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] Re: dev-version of HDF4
when does the gcc you must have: -L/Users/knutfd/Software/hdf-4.2.5/lib in order to find the lib so you need to do before the compile: export LDFLAGS=$LDFLAGS -L/Users/knutfd/Software/hdf-4.2.5/lib and obviously you are going to need the include files also: export CPPFLAGS=$CPPFLAGS -I/Users/knutfd/Software/hdf-4.2.5/include I am not quite sure if export is going to work or setenv in setenv you don't need the equal I am not an expert in c shell this kind of problem is because the tools are not install in a standard path library like /usr/lib and /usr/include so you have to define compilation flags On Wed, Apr 20, 2011 at 6:11 AM, Knut-Frode Dagestad knutfrodesop...@hotmail.com wrote: I forgot to say, but I have also tried by specifying the location of HDF4, with similar error: ... checking for SDreaddata in -lmfhdfalt... no checking for SDreaddata in -lmfhdf... no checking for SDreaddata in -lhdf4... no checking for SDreaddata in -lmfhdf... no checking for SDreaddata in -lmfhdf... no configure: error: HDF4 support requested with arg /Users/knutfd/Software/hdf-4.2.5/, but neither hdf4 nor mfhdf lib found ... HDF4 library is there, but somehow configure is not able to detect it. HDF4 is compiled without SLIB, so that should not be the problem. I have also tried with older version of HDF4 (4.2r1), other installation points, and prebuilt binaries. And I compiled with options --disable-fortran --disable-netcdf --with-pic, as suggested on http://osgeo-org.1803224.n2.nabble.com/Error-in-GDAL-compiling-with-HDF4-td3351437.html It has been suggested to use a dev version of HDF4, but I don't know if that would solve this problem? Best regards from Knut-Frode On 19/04/2011 21:51, Nikolaos Hatzopoulos wrote: hdf4 libraries not found that's what the log says :) do a locate libhdf4 to see where the library is On Tue, Apr 19, 2011 at 10:24 AM, Knut-Frode Dagestad knutfrodesop...@hotmail.com mailto:knutfrodesop...@hotmail.com wrote: I am trying to compile GDAL from source with support for HDF4 with: ./configure --with-hdf4 but get complaints about missing libraries, see extract from config.log: ld: library not found for -lmfhdfalt ... ld: library not found for -lmfhdf ... ld: library not found for -lhdf4 ... ld: library not found for -lmfhdf configure:19940: checking for SDreaddata in -lmfhdf configure:19965: gcc -o conftest -g -O2 conftest.c -lmfhdf -ldf -lsz -ljpeg -lz -lz -lpthread -ldl 5 ld: library not found for -lmfhdf configure:20009: error: HDF4 support requested with arg yes, but neither hdf4 nor mfhdf lib found Similar errors are also reported by others, e.g. this one using mapserver: http://osgeo-org.1803224.n2.nabble.com/cannot-find-lmfhdf-td5286909.html I have tried with various versions of HDF4, both binaries and compiled from source. The link above (and also http://trac.osgeo.org/gdal/wiki/BuildingOnUnix) suggests to try a hdf-dev version. But where can I find such dev-versions, in my case for Mac OS X 10.6.7? Would it be possible to update GDAL to work with standard HDF4 libraries? Best regards from Knut-Frode ___ gdal-dev mailing list gdal-dev@lists.osgeo.org mailto: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 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] Re: dev-version of HDF4
The paths are taken care of by configure, and they are checked to be ok. I also tried with standard installation folders (/usr/lib/ /usr/include/ etc) but no difference. I did not compile, since configure fails. So I believe it must be some incompatibility with the GDAL configure script and the standard HDF4-libraries I have used. The lib not found message from GDAL configure seems to be misleading. Best regards from Knut-Frode Den 20.04.2011 17:03, skrev Nikolaos Hatzopoulos: when does the gcc you must have: -L/Users/knutfd/Software/hdf-4.2.5/lib in order to find the lib so you need to do before the compile: export LDFLAGS=$LDFLAGS -L/Users/knutfd/Software/hdf-4.2.5/lib and obviously you are going to need the include files also: export CPPFLAGS=$CPPFLAGS -I/Users/knutfd/Software/hdf-4.2.5/include I am not quite sure if export is going to work or setenv in setenv you don't need the equal I am not an expert in c shell this kind of problem is because the tools are not install in a standard path library like /usr/lib and /usr/include so you have to define compilation flags On Wed, Apr 20, 2011 at 6:11 AM, Knut-Frode Dagestad knutfrodesop...@hotmail.com mailto:knutfrodesop...@hotmail.com wrote: I forgot to say, but I have also tried by specifying the location of HDF4, with similar error: ... checking for SDreaddata in -lmfhdfalt... no checking for SDreaddata in -lmfhdf... no checking for SDreaddata in -lhdf4... no checking for SDreaddata in -lmfhdf... no checking for SDreaddata in -lmfhdf... no configure: error: HDF4 support requested with arg /Users/knutfd/Software/hdf-4.2.5/, but neither hdf4 nor mfhdf lib found ... HDF4 library is there, but somehow configure is not able to detect it. HDF4 is compiled without SLIB, so that should not be the problem. I have also tried with older version of HDF4 (4.2r1), other installation points, and prebuilt binaries. And I compiled with options --disable-fortran --disable-netcdf --with-pic, as suggested on http://osgeo-org.1803224.n2.nabble.com/Error-in-GDAL-compiling-with-HDF4-td3351437.html It has been suggested to use a dev version of HDF4, but I don't know if that would solve this problem? Best regards from Knut-Frode On 19/04/2011 21:51, Nikolaos Hatzopoulos wrote: hdf4 libraries not found that's what the log says :) do a locate libhdf4 to see where the library is On Tue, Apr 19, 2011 at 10:24 AM, Knut-Frode Dagestad knutfrodesop...@hotmail.com mailto:knutfrodesop...@hotmail.com mailto:knutfrodesop...@hotmail.com mailto:knutfrodesop...@hotmail.com wrote: I am trying to compile GDAL from source with support for HDF4 with: ./configure --with-hdf4 but get complaints about missing libraries, see extract from config.log: ld: library not found for -lmfhdfalt ... ld: library not found for -lmfhdf ... ld: library not found for -lhdf4 ... ld: library not found for -lmfhdf configure:19940: checking for SDreaddata in -lmfhdf configure:19965: gcc -o conftest -g -O2 conftest.c -lmfhdf -ldf -lsz -ljpeg -lz -lz -lpthread -ldl 5 ld: library not found for -lmfhdf configure:20009: error: HDF4 support requested with arg yes, but neither hdf4 nor mfhdf lib found Similar errors are also reported by others, e.g. this one using mapserver: http://osgeo-org.1803224.n2.nabble.com/cannot-find-lmfhdf-td5286909.html I have tried with various versions of HDF4, both binaries and compiled from source. The link above (and also http://trac.osgeo.org/gdal/wiki/BuildingOnUnix) suggests to try a hdf-dev version. But where can I find such dev-versions, in my case for Mac OS X 10.6.7? Would it be possible to update GDAL to work with standard HDF4 libraries? Best regards from Knut-Frode ___ gdal-dev mailing list gdal-dev@lists.osgeo.org mailto:gdal-dev@lists.osgeo.org mailto:gdal-dev@lists.osgeo.org mailto:gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev ___ gdal-dev mailing list gdal-dev@lists.osgeo.org mailto:gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev ___ gdal-dev mailing list gdal-dev@lists.osgeo.org mailto:gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev ___ gdal-dev mailing list
[gdal-dev] How detect the BlockSize to make tiles of my dataset to open it?
Dear friends, Using gdalinfo and my dataset i obtain the following data: Size: 35000, 2 Pixel Size: 0.5, -0.5 Band 1 Block = 35000x1 Type=Byte, ColorInterp=Red Overviews: 17500x1, 8750x5000, 4375x2500, 2187x1250, 1093x625, 546x312, 273x156 Band 2 Block = 35000x1 Type=Byte, ColorInterp=Green Overviews: 17500x1, 8750x5000, 4375x2500, 2187x1250, 1093x625, 546x312, 273x156 Band 3 Block = 35000x1 Type=Byte, ColorInterp=Blue Overviews: 17500x1, 8750x5000, 4375x2500, 2187x1250, 1093x625, 546x312, 273x156 How can I recognize my optimal blocksize to open a 250 MB ecw file in TILES mode because if I read all the dataset I obtain an outofmemory exception. Thanks in advanced. Francisco J. ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] Re: dev-version of HDF4
this might help to fix you configure: sed -i 's|-lmfhdf -ldf|-L$libdir/hdf -lmfhdf -ldf|g' configure On Wed, Apr 20, 2011 at 8:27 AM, Knut-Frode knutfrodesop...@hotmail.comwrote: The paths are taken care of by configure, and they are checked to be ok. I also tried with standard installation folders (/usr/lib/ /usr/include/ etc) but no difference. I did not compile, since configure fails. So I believe it must be some incompatibility with the GDAL configure script and the standard HDF4-libraries I have used. The lib not found message from GDAL configure seems to be misleading. Best regards from Knut-Frode Den 20.04.2011 17:03, skrev Nikolaos Hatzopoulos: when does the gcc you must have: -L/Users/knutfd/Software/hdf-4.2.5/lib in order to find the lib so you need to do before the compile: export LDFLAGS=$LDFLAGS -L/Users/knutfd/Software/hdf-4.2.5/lib and obviously you are going to need the include files also: export CPPFLAGS=$CPPFLAGS -I/Users/knutfd/Software/hdf-4.2.5/include I am not quite sure if export is going to work or setenv in setenv you don't need the equal I am not an expert in c shell this kind of problem is because the tools are not install in a standard path library like /usr/lib and /usr/include so you have to define compilation flags On Wed, Apr 20, 2011 at 6:11 AM, Knut-Frode Dagestad knutfrodesop...@hotmail.com mailto:knutfrodesop...@hotmail.com wrote: I forgot to say, but I have also tried by specifying the location of HDF4, with similar error: ... checking for SDreaddata in -lmfhdfalt... no checking for SDreaddata in -lmfhdf... no checking for SDreaddata in -lhdf4... no checking for SDreaddata in -lmfhdf... no checking for SDreaddata in -lmfhdf... no configure: error: HDF4 support requested with arg /Users/knutfd/Software/hdf-4.2.5/, but neither hdf4 nor mfhdf lib found ... HDF4 library is there, but somehow configure is not able to detect it. HDF4 is compiled without SLIB, so that should not be the problem. I have also tried with older version of HDF4 (4.2r1), other installation points, and prebuilt binaries. And I compiled with options --disable-fortran --disable-netcdf --with-pic, as suggested on http://osgeo-org.1803224.n2.nabble.com/Error-in-GDAL-compiling-with-HDF4-td3351437.html It has been suggested to use a dev version of HDF4, but I don't know if that would solve this problem? Best regards from Knut-Frode On 19/04/2011 21:51, Nikolaos Hatzopoulos wrote: hdf4 libraries not found that's what the log says :) do a locate libhdf4 to see where the library is On Tue, Apr 19, 2011 at 10:24 AM, Knut-Frode Dagestad knutfrodesop...@hotmail.com mailto:knutfrodesop...@hotmail.com mailto:knutfrodesop...@hotmail.com mailto:knutfrodesop...@hotmail.com wrote: I am trying to compile GDAL from source with support for HDF4 with: ./configure --with-hdf4 but get complaints about missing libraries, see extract from config.log: ld: library not found for -lmfhdfalt ... ld: library not found for -lmfhdf ... ld: library not found for -lhdf4 ... ld: library not found for -lmfhdf configure:19940: checking for SDreaddata in -lmfhdf configure:19965: gcc -o conftest -g -O2 conftest.c -lmfhdf -ldf -lsz -ljpeg -lz -lz -lpthread -ldl 5 ld: library not found for -lmfhdf configure:20009: error: HDF4 support requested with arg yes, but neither hdf4 nor mfhdf lib found Similar errors are also reported by others, e.g. this one using mapserver: http://osgeo-org.1803224.n2.nabble.com/cannot-find-lmfhdf-td5286909.html I have tried with various versions of HDF4, both binaries and compiled from source. The link above (and also http://trac.osgeo.org/gdal/wiki/BuildingOnUnix) suggests to try a hdf-dev version. But where can I find such dev-versions, in my case for Mac OS X 10.6.7? Would it be possible to update GDAL to work with standard HDF4 libraries? Best regards from Knut-Frode ___ gdal-dev mailing list gdal-dev@lists.osgeo.org mailto:gdal-dev@lists.osgeo.org mailto:gdal-dev@lists.osgeo.org mailto:gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev ___ gdal-dev mailing list gdal-dev@lists.osgeo.org mailto:gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev ___ gdal-dev mailing list
Re: [gdal-dev] How detect the BlockSize to make tiles of my dataset to open it?
On 11-04-20 11:32 AM, Francisco José Reyes Peralta wrote: Dear friends, Using gdalinfo and my dataset i obtain the following data: *Size: 35000, 2* *Pixel Size: 0.5, -0.5* *Band 1 Block = 35000x1 Type=Byte, ColorInterp=Red* *Overviews: 17500x1, 8750x5000, 4375x2500, 2187x1250, 1093x625, 546x312, 273x156* *Band 2 Block = 35000x1 Type=Byte, ColorInterp=Green* *Overviews: 17500x1, 8750x5000, 4375x2500, 2187x1250, 1093x625, 546x312, 273x156* *Band 3 Block = 35000x1 Type=Byte, ColorInterp=Blue* *Overviews: 17500x1, 8750x5000, 4375x2500, 2187x1250, 1093x625, 546x312, 273x156* How can I recognize my optimal blocksize to open a 250 MB ecw file in TILES mode because if I read all the dataset I obtain an outofmemory exception. Francisco, I believe you will get the best performance reading it one scanline at a time with all bands at once. There is a special optimized case in the driver for this. But you would need to use the GDALDataset::RasterIO() method to read all three bands at once instead of reading them each separately. Best regards, -- ---+-- I set the clouds in motion - turn up | Frank Warmerdam, warmer...@pobox.com light and sound - activate the windows | http://pobox.com/~warmerdam and watch the world go round - Rush| Geospatial Programmer for Rent ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev
[gdal-dev] Re: How detect the BlockSize to make tiles of my dataset to open it?
Many thanks Frank, Could be useful it for avoid OutMemoryException? Regards. Francisco J. -- View this message in context: http://osgeo-org.1803224.n2.nabble.com/gdal-dev-How-detect-the-BlockSize-to-make-tiles-of-my-dataset-to-open-it-tp6291160p6291815.html Sent from the GDAL - Dev mailing list archive at Nabble.com. ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] Re: How detect the BlockSize to make tiles of my dataset to open it?
On 11-04-20 02:43 PM, gistdt08 wrote: Many thanks Frank, Could be useful it for avoid OutMemoryException? Francisco, Reading the image one scanline at a time can be accomplished in a modest amount of memory. Attempting to read the whole image at once would take ... lots of memory. So, yes I imagine so. Best regards, -- ---+-- I set the clouds in motion - turn up | Frank Warmerdam, warmer...@pobox.com light and sound - activate the windows | http://pobox.com/~warmerdam and watch the world go round - Rush| Geospatial Programmer for Rent ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev
[gdal-dev] cropping a tif with lat/lon
Hi there! Please forgive this terribly newbie question. Been searching all day and I just don't get it. I have a geotiff VFR image from the FAA with the following coordinates as reported by gdalinfo: Upper Left ( -143411.876, 94058.326) ( 78d44'4.05W, 39d49'53.24N) Lower Left ( -143411.876, -93607.521) ( 78d41'40.46W, 38d 7'55.46N) Upper Right ( 111698.876, 94058.326) ( 75d44'16.70W, 39d50'10.29N) Lower Right ( 111698.876, -93607.521) ( 75d46'8.55W, 38d 8'12.11N) Center ( -15856.500, 225.403) ( 77d14'2.52W, 38d59'36.84N) I would like to crop the file as follows: West_Bounding_Coordinate: -78.734457 East_Bounding_Coordinate: -75.737971 North_Bounding_Coordinate: 39.843493 South_Bounding_Coordinate: 38.132073 I guess the problem is I need to convert the -78.734457 into paramaters for gdal_translate, but when I run this it gives an error: gdal_translate -projwin -78.734457 39.843493 -75.737971 38.132073 in.tif out.tif What am I missing? Thanks!! -Dan -- View this message in context: http://osgeo-org.1803224.n2.nabble.com/cropping-a-tif-with-lat-lon-tp6292065p6292065.html Sent from the GDAL - Dev mailing list archive at Nabble.com. ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] cropping a tif with lat/lon
On 04/20/11 22:11, spalt wrote: I guess the problem is I need to convert the -78.734457 into paramaters for gdal_translate, but when I run this it gives an error: gdal_translate -projwin -78.734457 39.843493 -75.737971 38.132073 in.tif out.tif What error ? BTW, you are right, you must use the projected coordinates. ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev
[gdal-dev] Re: cropping a tif with lat/lon
Sorry, error is Input file size is 8000, 5885 Computed -srcwin 4494 2948 0 0 from projected window. -srcwin 4494 2948 0 0 falls outside raster size of 8000x5885 or is otherwise illegal. I am not sure I understand how to project the lat/lon. -Dan -- View this message in context: http://osgeo-org.1803224.n2.nabble.com/cropping-a-tif-with-lat-lon-tp6292065p6292152.html Sent from the GDAL - Dev mailing list archive at Nabble.com. ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] Re: cropping a tif with lat/lon
On 04/20/11 22:39, spalt wrote: I am not sure I understand how to project the lat/lon. That won't be necessary. Open your file with QGIS (or similar desktop application), and it will display the projected coordinates. ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev
[gdal-dev] Re: cropping a tif with lat/lon
Thanks Jean-Claude, that works -- in QGIS i can see the border I want to crop is -110270 89629 110288 -88560 -- but I guess what I am asking is if there is any way to do this programmatically.. i.e. automatically turn the lat/lon coordinates into these values. -Dan -- View this message in context: http://osgeo-org.1803224.n2.nabble.com/cropping-a-tif-with-lat-lon-tp6292065p6292227.html Sent from the GDAL - Dev mailing list archive at Nabble.com. ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] Re: cropping a tif with lat/lon
I am a newby too so I will share what I have learned lately. You can convert from one srs to the other using the cs2cs tool from proj.4 which is probably already installed if you have gdal. To test it I typed this lengthy command all cs2cs +proj=lcc +lat_1=44.34 +lat_2=46 +lat_0=43.66 \ +lon_0=-120.5 +x_0=250 +y_0=0 +ellps=GRS80 +units=m +to +proj=latlong \ +datum=WGS84 The program starts listening on stdin and I can feed it coordinate pairs in meters for my neighborhood by typing this on a line and hitting Enter. 2280696 101184 It responds on stdout with the pair converted to latlong as I have requested.. 123d15'36.84W 44d32'36.644N 0.000 Next I use control-D to exit. Then I can go the other direction by adding the -'I' option to the cs2cs command and I feed it the latlong pair. ('-I' just saves me some typing.) It responded with 2280696.01 101184.01 0.00 This is reasonably close to what I started with. (What's 1 cm among friends?) To make it work, you would have to know the projection that your FAA chart is in (UTM zone something right?), convert it into the funny format that proj.4 understands, and build a command line. Then you could put your latlong corners into a file, feed them into cs2cs, get the corners back in the FAA space and feed them to the gdal command. Taking a stab at it, for zone 10N where I live I would try this +proj=utm +zone=10 +north +ellps=GRS80 +units=m I looked up the projection stuff with grep because I happen to know the EPSG code for it is 102326. Then I cut and pasted. The latlong part came from google and the cs2cs manpage. grep 102326 /usr/local/share/proj/esri 102326 +proj=lcc +lat_1=44.34 +lat_2=46 +lat_0=43.66 +lon_0=-120.5 +x_0=250 +y_0=0 +ellps=GRS80 +units=m no_defs Anyway - if I needed to do this TODAY that's what I would do because it's now in my meager skill set. Someone inspired by my clumsiness might be inspired now to chime in with a more elegant way to do this. Hope this helps Brian ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev
[gdal-dev] Re: cropping a tif with lat/lon
Hi Brian- Thanks so much for your help. That works, though I feel a little silly now because I am realizing the lat/lon the FAA provides with these is the corners of the entire map image, not the map itself (these maps have a lot of white borders around them, which is what I am trying to crop). I guess it is back to the drawing board. Anyway, thanks again. -Dan -- View this message in context: http://osgeo-org.1803224.n2.nabble.com/cropping-a-tif-with-lat-lon-tp6292065p6293047.html Sent from the GDAL - Dev mailing list archive at Nabble.com. ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev
[gdal-dev] Utils problem
Hello everyone, I'm very new to OSGeo. I just had a question. Why do I get error of no module named utils when I include a line of import utils. I'm using OGGeo4w. Thank you for your help. Jay ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev
[gdal-dev] Utils module problem
Hello everyone, I'm very new to OSGeo. I just had a question. Why do I get error of no module named utils when I include a line of import utils. I'm using OGGeo4w. Thank you for your help. Jay ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] Re: cropping a tif with lat/lon
Dan use nearblack to add a alpha or mask band, and collar the image Brian On Wed, 2011-04-20 at 19:15 -0700, spalt wrote: Hi Brian- Thanks so much for your help. That works, though I feel a little silly now because I am realizing the lat/lon the FAA provides with these is the corners of the entire map image, not the map itself (these maps have a lot of white borders around them, which is what I am trying to crop). I guess it is back to the drawing board. Anyway, thanks again. -Dan -- View this message in context: http://osgeo-org.1803224.n2.nabble.com/cropping-a-tif-with-lat-lon-tp6292065p6293047.html Sent from the GDAL - Dev mailing list archive at Nabble.com. ___ 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