Re: [gdal-dev] Downsample with averaging?
Jay, The external overview files are created in TIFF format. I checked. However, most of the metadata will be lost. You can recover the metadata by using gdal_translate with -outsize 3.125% 3.125%. It will read the metadata from the original file and the pixels from the level 32 overview. Regarding the 2.1GB file: Check if the directory is not read-only and the disk has sufficient space. Run gdaladdo with the environment variable CPL_DEBUG set to YES and report the messages. You can also try gdalwarp multiple times with the resampling method set to something other than 'near' and 'bilinear'. However, I am not sure if this will give you want you want. On Tue, Feb 22, 2011 at 4:26 AM, Jay Jennings jennings@geoeye.comwrote: Unfortunately I can’t provide the file (it’s about 2.1 GB and not releasable), but below is the ‘gdalinfo’ dump for it. The problem may be related to size of the input, because the same command worked OK on a GeoTiff that is “only” 975 MB. BTW For the 975 GB run that succeeded, the created overview was named *.ovr rather than *.tif. Is this expected ? The guidance for ‘gdaladdo’ hints that the created *.ovr is actually a TIFF, but that’s not true here (I tried renaming it *.tif, but no TIFF reader could open it). Driver: GTiff/GeoTIFF Files: XX.tif Size is 25733, 27840 Coordinate System is: GEOGCS[WGS 84, DATUM[WGS_1984, SPHEROID[WGS 84,6378137,298.257223563, AUTHORITY[EPSG,7030]], AUTHORITY[EPSG,6326]], PRIMEM[Greenwich,0], UNIT[degree,0.0174532925199433], AUTHORITY[EPSG,4326]] Origin = (-100.375165330488004,29.624901844319002) Pixel Size = (0.04869286704,-0.04495684143) Metadata: TIFFTAG_DATETIME=2009:07:17 06:16:07 TIFFTAG_ARTIST=GeoEye TIFFTAG_COPYRIGHT=(C) COPYRIGHT GeoEye, All Rights Reserved TIFFTAG_MINSAMPLEVALUE=0 TIFFTAG_MAXSAMPLEVALUE=255 AREA_OR_POINT=Area Image Structure Metadata: INTERLEAVE=PIXEL Corner Coordinates: Upper Left ( -100.3751653, 29.6249018) ( 100d22'30.60W, 29d37'29.65N) Lower Left ( -100.3751653, 29.4997420) ( 100d22'30.60W, 29d29'59.07N) Upper Right ( -100.2498639, 29.6249018) ( 100d14'59.51W, 29d37'29.65N) Lower Right ( -100.2498639, 29.4997420) ( 100d14'59.51W, 29d29'59.07N) Center ( -100.3125146, 29.5623219) ( 100d18'45.05W, 29d33'44.36N) Band 1 Block=512x512 Type=Byte, ColorInterp=Red Band 2 Block=512x512 Type=Byte, ColorInterp=Green Band 3 Block=512x512 Type=Byte, ColorInterp=Blue *From:* Chaitanya kumar CH [mailto:chaitanya...@gmail.com] *Sent:* Monday, February 21, 2011 4:19 PM *To:* Jay Jennings *Cc:* gdal-dev@lists.osgeo.org *Subject:* Re: [gdal-dev] Downsample with averaging? Jay, Can you provide a sample file that gives this error? On Tue, Feb 22, 2011 at 1:56 AM, Jay Jennings jennings@geoeye.com wrote: Hello list, (using GDAL 1.8.0) I am trying to create a 32:1 down-sampled overview of a GeoTiff satellite image. My first thought was gdal_translate, with args such as “-outsize 3.125% 3.125%”… which produces surprisingly high quality given the absence of a resampling option. However I’m looking for a downsampling scheme that creates a result pixel by averaging all relevant source pixels (I know, for 32:1 downsample, that means 1024 source pixels for each result pixel !) with the hope of an output that is not “speckled” or “grainy” insofar as possible. I also looked at gdaladdo, which does have the “-r average” resampling option… the guidance at gdal.org seems to suggest that it can produce a 32:1 GeoTIFF external overview with a command like this: gdaladdo -r average -ro X.tif 32 But that produces a surprising error message, namely: ERROR 4: `X.tif.ovr' does not exist in the file system, and is not recognised as a supported dataset name. Am I barking up the wrong tree with gdaladdo for this purpose ? Anybody have any suggestions for highest-quality down-sampling ? Thanks in advance. --Jay Jennings ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev -- 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 -- 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
Re: [gdal-dev] Downsample with averaging?
On Feb 21, 2011, at 3:26 PM, Jay Jennings wrote: Hello list, (using GDAL 1.8.0) I am trying to create a 32:1 down-sampled overview of a GeoTiff satellite image. My first thought was gdal_translate, with args such as “-outsize 3.125% 3.125%”… which produces surprisingly high quality given the absence of a resampling option. However I’m looking for a downsampling scheme that creates a result pixel by averaging all relevant source pixels (I know, for 32:1 downsample, that means 1024 source pixels for each result pixel !) with the hope of an output that is not “speckled” or “grainy” insofar as possible. I also looked at gdaladdo, which does have the “-r average” resampling option… the guidance at gdal.org seems to suggest that it can produce a 32:1 GeoTIFF external overview with a command like this: gdaladdo -r average -ro X.tif 32 But that produces a surprising error message, namely: ERROR 4: `X.tif.ovr' does not exist in the file system, and is not recognised as a supported dataset name. Am I barking up the wrong tree with gdaladdo for this purpose ? Anybody have any suggestions for highest-quality down-sampling ? Thanks in advance. Jay I think you need to build your overlays incrementally in order to get the average of the 'block' at each overview level as gdaladdo has a very small sampling window gdaladdo -r average my.tif 2 4 8 16 32 better to use gauss sampling see http://en.wikipedia.org/wiki/Pyramid_%28image_processing%29 gdaladdo -r gauss my.tiff 2 4 8 16 32 note you may want to convert your image to a floating point form first so as not to possibly lose precision due to the multiple passes there is a gdal method to extract a single overview level from a tif but I can never remember it maybe someone will chime in if not you can use your gdal_translate trick. HTH Norman ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev
[gdal-dev] Re: [Qgis-developer] Issue saving shapefiles with REAL15 values
Am 22.02.2011, 13:19 Uhr, schrieb Paolo Cavallini cavall...@faunalia.it: Il giorno mar, 22/02/2011 alle 13.16 +0100, Anita Graser ha scritto: I have a shapefile containing fields of type REAL15. I'd like to cut an area of interest out of this shapefile using QGIS Save as ... function. The resulting shapefile still has fields of type REAL15 but the contained values are botched, e.g. 1040603695 becomes -2147483648. I'm uncertain whether the problem lies with GDAL or QGIS' use of GDAL. Which versions? OSGeo4W r15203 with GDAL 1.8.0 It would be great if this problem could be resolved. Unfortunately, I can't share the original (commercial) dataset. You can extract just one record, and share that one. How? If I use QGIS, the values will be broken. Best wishes, Anita ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] Re: [Qgis-developer] Issue saving shapefiles with REAL15 values
Anita, First, let us isolate the source of this error. QGIS or GDAL/OGR. Use ogr2ogr to clip the part you did with QGIS. See the extents of the clipped shapefile using ogrinfo and use it with the ogr2ogr utility. http://www.gdal.org/ogr2ogr.html On Tue, Feb 22, 2011 at 6:07 PM, Anita Graser anitagra...@gmx.at wrote: Am 22.02.2011, 13:19 Uhr, schrieb Paolo Cavallini cavall...@faunalia.it: Il giorno mar, 22/02/2011 alle 13.16 +0100, Anita Graser ha scritto: I have a shapefile containing fields of type REAL15. I'd like to cut an area of interest out of this shapefile using QGIS Save as ... function. The resulting shapefile still has fields of type REAL15 but the contained values are botched, e.g. 1040603695 becomes -2147483648. I'm uncertain whether the problem lies with GDAL or QGIS' use of GDAL. Which versions? OSGeo4W r15203 with GDAL 1.8.0 It would be great if this problem could be resolved. Unfortunately, I can't share the original (commercial) dataset. You can extract just one record, and share that one. How? If I use QGIS, the values will be broken. Best wishes, Anita ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev -- 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
Re: [gdal-dev] Downsample with averaging?
Le 22/02/2011 16:39, Jay Jennings a écrit : there is a gdal method to extract a single overview level from a tif but I can never remember it maybe someone will chime in... If so, that would be really helpful. Does anyone know how to extract a single overview from a pyramid’d image such as made from a command like: gdaladdo .tif 2 4 8 16 32 64 128 256 gdal_translate with the -outsize parameter should do the job. Jean-Claude ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev
[gdal-dev] Re: [Qgis-developer] Issue saving shapefiles with REAL15 values
Am 22.02.2011, 14:49 Uhr, schrieb Barry Rowlingson b.rowling...@lancaster.ac.uk: On Tue, Feb 22, 2011 at 12:37 PM, Anita Graser anitagra...@gmx.at wrote: You can extract just one record, and share that one. How? If I use QGIS, the values will be broken. ogr2ogr on the command line? ogr2ogr results in the same broken values. Looks like it's a GDAL problem. what does ogrinfo say about it? INFO: Open of `nw.shp' using driver `ESRI Shapefile' successful. 1: autautnw_wien (Line String) Can you load the DBF in a spreadsheet? Yes, Openoffice loads them. The header says ID,N,15,0. QGIS displays REAL15 in fields tab of layer properties. How do you know what the values are supposed to be? The data comes with documentation. Thanks for your help, Anita ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] Re: [Qgis-developer] Issue saving shapefiles with REAL15 values
Hi, I used the following ogr2ogr command: ogr2ogr -sql select * from nw where NAME = 'Am Johannesberg' new.shp nw.shp The resulting shp contains correct geometries, but the values in ID,N,15,0 fields are broken. I guess that shows that it's a GDAL/OGR problem. Thanks, best wishes, Anita Am 22.02.2011, 16:33 Uhr, schrieb Chaitanya kumar CH chaitanya...@gmail.com: Anita, First, let us isolate the source of this error. QGIS or GDAL/OGR. Use ogr2ogr to clip the part you did with QGIS. See the extents of the clipped shapefile using ogrinfo and use it with the ogr2ogr utility. http://www.gdal.org/ogr2ogr.html ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] Re: [Qgis-developer] Issue saving shapefiles with REAL15 values
Anita, Is it possible to send a small sample data to my email for testing? Doesn't matter if the ID field values are wrong. On Tue, Feb 22, 2011 at 9:21 PM, Anita Graser anitagra...@gmx.at wrote: Hi, I used the following ogr2ogr command: ogr2ogr -sql select * from nw where NAME = 'Am Johannesberg' new.shp nw.shp The resulting shp contains correct geometries, but the values in ID,N,15,0 fields are broken. I guess that shows that it's a GDAL/OGR problem. Thanks, best wishes, Anita Am 22.02.2011, 16:33 Uhr, schrieb Chaitanya kumar CH chaitanya.ch@ gmail.com: Anita, First, let us isolate the source of this error. QGIS or GDAL/OGR. Use ogr2ogr to clip the part you did with QGIS. See the extents of the clipped shapefile using ogrinfo and use it with the ogr2ogr utility. http://www.gdal.org/ogr2ogr.html ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev -- 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
RE: [gdal-dev] Downsample with averaging?
Brilliant ! That works well, and fast. For the record, a command like: gdal_translate -outsize 3.125% 3.125% .tif _dzm32.tif serves to extract the 32:1 reduced-resolution level from a file created with a command like: gdaladdo -r cubic .tif 2 4 8 16 32 64 128 256 and the result is a nicely smoothed dezoom of the original. -Original Message- From: gdal-dev-boun...@lists.osgeo.org [mailto:gdal-dev-boun...@lists.osgeo.org] On Behalf Of Jean-Claude Repetto Sent: Tuesday, February 22, 2011 10:48 AM To: gdal-dev@lists.osgeo.org Subject: Re: [gdal-dev] Downsample with averaging? Le 22/02/2011 16:39, Jay Jennings a écrit : there is a gdal method to extract a single overview level from a tif but I can never remember it maybe someone will chime in... If so, that would be really helpful. Does anyone know how to extract a single overview from a pyramid'd image such as made from a command like: gdaladdo .tif 2 4 8 16 32 64 128 256 gdal_translate with the -outsize parameter should do the job. Jean-Claude ___ 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] GDAL JP2KAK plugin for lossless 16 bit
Hi, I've been trying to create a lossless JPEG2000 image from a signed 16-bit DEM (stored in a TIFF file), but have had no success so far with JP2KAK. My DEM has large NoData regions (value is DTED NoData : -32767) I tried different GDAL versions (1.7 1.8), and different versions of KAKADU (6.3, 6.2) I'm using gdal_translate -of JP2KAK -co QUALITY=100 input.tif output.tif The image is created with no errors, but shows strong artefacts around Nodata parts, while the large NoData areas are transformed to random 16bit garbage. It's not a solution to use lossy conversion, because NoData values would be lost. However, using kakadu tools there is no problem : Creversible is used instead of QUALITY=100 kdu_compress.exe -i source.tif -o target.jp2 Clayers=12 Creversible=yes So I guess the problem comes from GDAL JP2KAK driver. A quick look at the code gave me no clue. I also checked if it was coming from the signed type (Int16), but that problem also occurs with unsigned 16-bit data (same data with a +32768 offset to have positive values) thanks in advance for any hint, best regards, Frederic Claudel ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] GDAL JP2KAK plugin for lossless 16 bit
On 11-02-22 11:31 AM, Frederic CLAUDEL wrote: Hi, I've been trying to create a lossless JPEG2000 image from a signed 16-bit DEM (stored in a TIFF file), but have had no success so far with JP2KAK. My DEM has large NoData regions (value is DTED NoData : -32767) I tried different GDAL versions (1.7 1.8), and different versions of KAKADU (6.3, 6.2) I'm using gdal_translate -of JP2KAK -co QUALITY=100 input.tif output.tif The image is created with no errors, but shows strong artefacts around Nodata parts, while the large NoData areas are transformed to random 16bit garbage. Frederic, I would encourage you to file a ticket and I'll investigate. I believe there is a bug in the JP2KAK driver. I started some related improvements a couple months ago but let them fall by the wayside since no one seemed to be running into the problems. 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] 2011 FOSS4G Call for Papers
Folks, The call for presentations for FOSS4G 2011 in Denver is now open. The full announcement follows: Open Source Geospatial Conference Calls for Speakers Education for All Levels of Ability and Experience DENVER, Feb. 22, 2011 -- The Free and Open Source Software for Geospatial (FOSS4G) conference is reaching out to speakers interested in presenting at the 2011 conference that will be held Sept. 12 - 16 in Denver, CO, USA. FOSS4G is the premier international conference focused on open source geospatial software. The open source geospatial toolset is mature with enterprise-class deployments across the globe at all levels of enterprise for a wide variety of applications. Users and developers are encouraged to present their latest projects and software development work to demonstrate the power of open source geospatial solutions. The organizers are looking for a good mix of content for all levels of ability and experience with open source. In addition to high-caliber sessions for developers, there are plans for several workshops and sessions that will welcome non-technical decision makers to the power, capability and compelling business case for open source geospatial software. Presentation topics will include case studies of open source applications, benchmarks of performance between different components, visualization tips and tricks, and new tool developments, hacks and mashups. In addition to the core focus on free and open source software, this year’s conference will also feature a major focus on free and open data. Content may cover systems that are solely open source or a combination of open and closed source solutions. Sessions will run in seven concurrent tracks with space for around 135 presentations in both a regular program and an academic program. Presentations will either fill 30-minute slots with time for questions or 5-minute lightning talks. Proposals can be submitted online at http://2011.foss4g.org/program/. There is pent up demand in the North American market for this content given the growth in open source geospatial solutions and the fact that this is the first time this international event will return to a North American venue in four years. “With the current strong interest in open source geospatial solutions, we anticipate an attendance of around a thousand people” said Peter Batty, conference committee chair and vice president of geospatial technology at Ubisense, Inc. “We have a great venue and an experienced organizing team, and believe this will be one of the premier geospatial events of 2011.” This year’s FOSS4G event is also adjacent to State of the Map, the annual international conference focused on OpenStreetMap, the wiki-style creator and provider of free geographic data that has recently garnered corporate support from both MapQuest and Microsoft. The ability to attend both events with one trip to Denver in September makes for a great opportunity to learn about the latest developments in the geospatial industry. The event already has strong support, with major sponsors that include Esri, Google, OpenGeo, MapQuest, Newmont and Safe Software. Bronze sponsors include CamptoCamp, EOX, GeoCat, GeoIQ, GeoSolutions, Korem, MapGears, Metaspatial, Oracle Spatial, Spatial Networks and Terrestris. You can view an updated list of sponsors at http://2011.foss4g.org/sponsors. About FOSS4G FOSS4G is the global conference focused on Free and Open Source Software for Geospatial that is organized by the Open Source Geospatial Foundation (OSGeo) with support from an all-volunteer organizing committee and professional conference management from the Geospatial Information Technology Association (GITA). The 2011 FOSS4G event in Denver marks the first North American event in four years, with the prior three events taking place in Barcelona, Sydney and Cape Town. SOURCE FOSS4G Organizing Committee RELATED LINKS: http://2011.foss4g.org/ FOSS4G Denver 2011 http://www.osgeo.org/ Open Source Geospatial Foundation http://stateofthemap.org/ State of the Map Conference http://www.gita.org/ Geospatial Information Technology Association -- ---+-- 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] What's the best/simplest gdal binary for Windows 7?
Dear all, I am providing some python/gdal based libraries to Windows 7 users who are no programmers, so no mingw or VisualStudio is available and I am a Mac User. Which of the several should I recommend them to install? Best regards, Michael ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] Re: Gdal2tiles in Gdal18 and creating KMZ files
I have been working with the png creation option under gdal_translate -of kmlsuperoverlay to create kmz files that include transparency. I haven't had much luck with controlling specific colors that becomes transparent, or even maintaining transparency in the source HFA file. The handling of transparency is different from gdal2tiles, where I have had good results. This leads me back to gdal2tiles and attempting to create a kmz file from the tile structure. The key difference I see between the .kml files using the two different processes is below. In order to be able to compress the gdal2tiles output into one file, I believe that I may need to modify gdal2tiles.py to create the gx:LatLonQuad tag from section 1 below as opposed to the LatLonBox from section 2 below. Does anyone know the difference between gx:LatLonQuad and LatLonBox before I decide if this change is appropriate?: (1) KML Superoverlay snippet: GroundOverlay drawOrder0/drawOrder Icon href0.png/href /Icon gx:LatLonQuad coordinates -74.885604, 40.373168, 0 -74.269963, 40.373582, 0 -74.267506, 41.083329, 0 -74.889723, 41.082904, 0 /coordinates /gx:LatLonQuad /GroundOverlay (2)GDAL2Tiles Kml snippet: GroundOverlay drawOrder16/drawOrder Icon href159.png/href /Icon LatLonBox north40.97989806962016/north south39.90973623453719/south east-74.531250/east west-75.937500/west /LatLonBox /GroundOverlay Thanks Again, Roland On Sun, Feb 20, 2011 at 6:12 AM, Vadim Shlyakhov vadp.d...@gmail.comwrote: brian rush at winkey.org writes: the problem is in /12/1211/2558.kml line 26 href2558.png/href this should be a relative path from the root of the zipfile not from 2558.kml Hello Brian, I've made another tile cutter (http://code.google.com/p/tilers-tools/). It produces a directory tree in a manner which is very similar to gdal2tiles.py. So I had a look into this problem. I must say it didn't work for me either: GE shows KML just fine, but if I zip a dir tree into KMZ it fails altogether. I've tried relative paths to PNGs, to internal KMLs. All these were to no avail. I think that the problem actually lies in 'NetworkLink' things and I still cannot get a clue on these. I wonder if you have (or can produce manually) a sample of working KMZ with superoverlays, so I'd be able to have a look ___ 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] What's the best/simplest gdal binary for Windows 7?
Michael, I am running Windows 7 and I use the Osgeo4w installer with the advanced install option to select the specific gdal and python libraries that I need. The default gdal1.8 is recommended. Osgeo4w can be found here: http://trac.osgeo.org/osgeo4w/ Without knowing your specific application, the setup interface allows you to easily add, remove, or update libraries to meet your needs. Best Wishes, Roland On Tue, Feb 22, 2011 at 3:17 PM, K.-Michael Aye kmichael@gmail.comwrote: Dear all, I am providing some python/gdal based libraries to Windows 7 users who are no programmers, so no mingw or VisualStudio is available and I am a Mac User. Which of the several should I recommend them to install? Best regards, Michael ___ 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] How to use GDAL C++ dynamically?
Hello List, I wonder if someone could point me into the right direction. I would like to use GDAL as loaded DLL at run time, with LoadLibray() call under windows and corresponding calls under Linux. I see that most of the functions are virtual, so it seems it is made with this in mind. I am trying to compile simple program: #include stdafx.h #include windows.h #define CPL_DLL #include ogrsf_frmts.h typedef void (* pOGRRegisterAll)(); typedef OGRSFDriverRegistrar * (*pGetRegistar)(); int _tmain(int argc, _TCHAR* argv[]) { const char *pszDriverName = ESRI Shapefile; HMODULE hDll = LoadLibrary(gdal18.dll); if(!hDll) { fprintf(stderr,Cannot load library\n); exit(0); } pOGRRegisterAll pRegFunc = (pOGRRegisterAll)GetProcAddress(hDll,OGRRegisterAll); (*pRegFunc)(); OGRSFDriver *poDriver; OGRSFDriverRegistrar * poRegistrar; pGetRegistar pRegistrarFunc = (pGetRegistar)GetProcAddress(hDll,?GetRegistrar@OGRSFDriverRegistrar@@SAPAV1@XZ); if(pRegistrarFunc == NULL ) { printf( Cannot get registrar\n); exit( 1 ); } poRegistrar = (*pRegistrarFunc)(); if( poRegistrar == NULL ) { printf( Cannot get poRegistrar\n); exit( 1 ); } // link error here: poDriver = poRegistrar-GetDriverByName(pszDriverName); if( poDriver == NULL ) { printf( %s driver not available.\n, pszDriverName ); exit( 1 ); } return 0; } This is just part of the GDAL API tutorial. I see two problems here: 1. I have to use C++ mangled names, which is not very nice. Is there .DEF file for GDAL with meaningful names? 2. I got a link error, which apparently clear why, because GetDriverByName() is not virtual. Now then could I create new files if GDAL is loaded dynamically? I am using latest GDAL source with VC++ 2010 I tried to search mail list but did not seem find anything. Thank you very much, Mikhail ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] How to use GDAL C++ dynamically?
Le mardi 22 février 2011 23:14:50, Mikhail Tchernychev a écrit : Hello List, I wonder if someone could point me into the right direction. I would like to use GDAL as loaded DLL at run time, with LoadLibray() call under windows and corresponding calls under Linux. I see that most of the functions are virtual, so it seems it is made with this in mind. I am trying to compile simple program: I think you are going to inflict you a lot of pain with LoadLibrary() and C++ API at the same time ! If you really need to dynamicly load gdal, use the GDAL C API instead... #include stdafx.h #include windows.h #define CPL_DLL #include ogrsf_frmts.h typedef void (* pOGRRegisterAll)(); typedef OGRSFDriverRegistrar * (*pGetRegistar)(); int _tmain(int argc, _TCHAR* argv[]) { const char *pszDriverName = ESRI Shapefile; HMODULE hDll = LoadLibrary(gdal18.dll); if(!hDll) { fprintf(stderr,Cannot load library\n); exit(0); } pOGRRegisterAll pRegFunc = (pOGRRegisterAll)GetProcAddress(hDll,OGRRegisterAll); (*pRegFunc)(); OGRSFDriver *poDriver; OGRSFDriverRegistrar * poRegistrar; pGetRegistar pRegistrarFunc = (pGetRegistar)GetProcAddress(hDll,?GetRegistrar@OGRSFDriverRegistrar@@SAPA V1@XZ); if(pRegistrarFunc == NULL ) { printf( Cannot get registrar\n); exit( 1 ); } poRegistrar = (*pRegistrarFunc)(); if( poRegistrar == NULL ) { printf( Cannot get poRegistrar\n); exit( 1 ); } // link error here: poDriver = poRegistrar-GetDriverByName(pszDriverName); if( poDriver == NULL ) { printf( %s driver not available.\n, pszDriverName ); exit( 1 ); } return 0; } This is just part of the GDAL API tutorial. I see two problems here: 1. I have to use C++ mangled names, which is not very nice. Is there .DEF file for GDAL with meaningful names? 2. I got a link error, which apparently clear why, because GetDriverByName() is not virtual. Now then could I create new files if GDAL is loaded dynamically? I am using latest GDAL source with VC++ 2010 I tried to search mail list but did not seem find anything. Thank you very much, Mikhail ___ 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] How to use GDAL C++ dynamically?
This is what I normally do, however it's not much less pain, even it's simple. I typically write a wrapper to execute all GetProcAdress() functions at once and store pointers in the class. Taking into number of GDAL functions, its' would be very challenging. Mikhail On 2/22/2011 2:43 PM, Even Rouault wrote: Le mardi 22 février 2011 23:14:50, Mikhail Tchernychev a écrit : Hello List, I wonder if someone could point me into the right direction. I would like to use GDAL as loaded DLL at run time, with LoadLibray() call under windows and corresponding calls under Linux. I see that most of the functions are virtual, so it seems it is made with this in mind. I am trying to compile simple program: I think you are going to inflict you a lot of pain with LoadLibrary() and C++ API at the same time ! If you really need to dynamicly load gdal, use the GDAL C API instead... #include stdafx.h #includewindows.h #define CPL_DLL #include ogrsf_frmts.h typedef void (* pOGRRegisterAll)(); typedef OGRSFDriverRegistrar * (*pGetRegistar)(); int _tmain(int argc, _TCHAR* argv[]) { const char *pszDriverName = ESRI Shapefile; HMODULE hDll = LoadLibrary(gdal18.dll); if(!hDll) { fprintf(stderr,Cannot load library\n); exit(0); } pOGRRegisterAll pRegFunc = (pOGRRegisterAll)GetProcAddress(hDll,OGRRegisterAll); (*pRegFunc)(); OGRSFDriver *poDriver; OGRSFDriverRegistrar * poRegistrar; pGetRegistar pRegistrarFunc = (pGetRegistar)GetProcAddress(hDll,?GetRegistrar@OGRSFDriverRegistrar@@SAPA V1@XZ); if(pRegistrarFunc == NULL ) { printf( Cannot get registrar\n); exit( 1 ); } poRegistrar = (*pRegistrarFunc)(); if( poRegistrar == NULL ) { printf( Cannot get poRegistrar\n); exit( 1 ); } // link error here: poDriver = poRegistrar-GetDriverByName(pszDriverName); if( poDriver == NULL ) { printf( %s driver not available.\n, pszDriverName ); exit( 1 ); } return 0; } This is just part of the GDAL API tutorial. I see two problems here: 1. I have to use C++ mangled names, which is not very nice. Is there .DEF file for GDAL with meaningful names? 2. I got a link error, which apparently clear why, because GetDriverByName() is not virtual. Now then could I create new files if GDAL is loaded dynamically? I am using latest GDAL source with VC++ 2010 I tried to search mail list but did not seem find anything. Thank you very much, Mikhail ___ 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] How to use GDAL C++ dynamically?
I just tried: If I declare make functions of OGRSFDriverRegistrar as virtual, everything is working as expected. Most of the functions of other classes are virtual, why those are not? Best Regards, Mikhail On 2/22/2011 2:43 PM, Even Rouault wrote: Le mardi 22 février 2011 23:14:50, Mikhail Tchernychev a écrit : Hello List, I wonder if someone could point me into the right direction. I would like to use GDAL as loaded DLL at run time, with LoadLibray() call under windows and corresponding calls under Linux. I see that most of the functions are virtual, so it seems it is made with this in mind. I am trying to compile simple program: I think you are going to inflict you a lot of pain with LoadLibrary() and C++ API at the same time ! If you really need to dynamicly load gdal, use the GDAL C API instead... #include stdafx.h #includewindows.h #define CPL_DLL #include ogrsf_frmts.h typedef void (* pOGRRegisterAll)(); typedef OGRSFDriverRegistrar * (*pGetRegistar)(); int _tmain(int argc, _TCHAR* argv[]) { const char *pszDriverName = ESRI Shapefile; HMODULE hDll = LoadLibrary(gdal18.dll); if(!hDll) { fprintf(stderr,Cannot load library\n); exit(0); } pOGRRegisterAll pRegFunc = (pOGRRegisterAll)GetProcAddress(hDll,OGRRegisterAll); (*pRegFunc)(); OGRSFDriver *poDriver; OGRSFDriverRegistrar * poRegistrar; pGetRegistar pRegistrarFunc = (pGetRegistar)GetProcAddress(hDll,?GetRegistrar@OGRSFDriverRegistrar@@SAPA V1@XZ); if(pRegistrarFunc == NULL ) { printf( Cannot get registrar\n); exit( 1 ); } poRegistrar = (*pRegistrarFunc)(); if( poRegistrar == NULL ) { printf( Cannot get poRegistrar\n); exit( 1 ); } // link error here: poDriver = poRegistrar-GetDriverByName(pszDriverName); if( poDriver == NULL ) { printf( %s driver not available.\n, pszDriverName ); exit( 1 ); } return 0; } This is just part of the GDAL API tutorial. I see two problems here: 1. I have to use C++ mangled names, which is not very nice. Is there .DEF file for GDAL with meaningful names? 2. I got a link error, which apparently clear why, because GetDriverByName() is not virtual. Now then could I create new files if GDAL is loaded dynamically? I am using latest GDAL source with VC++ 2010 I tried to search mail list but did not seem find anything. Thank you very much, Mikhail ___ 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] JP2KAK driver - nitf, j2p blocks, with color space of YCC
Hi Frank, all, Just fyi we had some nitf data that had jp2 blocks with ycc color space(JP2_sYCC_SPACE=18) . ossim was crashing because the bands were set to 3 in the nitf but kakadu was expanding only one channel. I checked gdal and it was returning only one band(no crash). Anyway feeding the kdu_channel_mapping::configure the jp2_source* instead of the raw codestream fixed the issue for us. The supplier of the data would not release a sample for you. Sorry. Just thought I'd let you know. Maybe you could scrounge a sample somewhere. Take care, Dave ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev