<html><head></head><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px"><div id="yui_3_16_0_ym19_1_1475755398051_258720"><span id="yui_3_16_0_ym19_1_1475755398051_258752">Thanks for the reply, Even! </span></div><div id="yui_3_16_0_ym19_1_1475755398051_258720"><span><br></span></div><div id="yui_3_16_0_ym19_1_1475755398051_258720" dir="ltr"><span id="yui_3_16_0_ym19_1_1475755398051_258821">I can do </span>gdalinfo c:\pathToFile\filename.h5.</div><div id="yui_3_16_0_ym19_1_1475755398051_258720" dir="ltr"><br></div><div id="yui_3_16_0_ym19_1_1475755398051_258720" dir="ltr">What do you mean, " try accessing the subdataset it will report. The </div><div id="yui_3_16_0_ym19_1_1475755398051_258865">expected syntax is like HDF5:"c:\pathToFile\filename.h5":subdataset_name"?</div><div class="qtdSeparateBR" id="yui_3_16_0_ym19_1_1475755398051_258721"><br></div><div class="qtdSeparateBR" id="yui_3_16_0_ym19_1_1475755398051_258721" dir="ltr">Do you mean gdalinfo HDF5:"c:\pathtoFile\filename.h5"://ImageData/h2?</div><div class="qtdSeparateBR" id="yui_3_16_0_ym19_1_1475755398051_258721" dir="ltr"><br></div><div class="qtdSeparateBR" id="yui_3_16_0_ym19_1_1475755398051_258721" dir="ltr">When I do that, I get:</div><div class="qtdSeparateBR" id="yui_3_16_0_ym19_1_1475755398051_258721" dir="ltr"><br></div><div class="qtdSeparateBR" id="yui_3_16_0_ym19_1_1475755398051_258721" dir="ltr"> ERROR 4: `HDF5:c:\pathToFile\filename.h5://ImageData/h2' does not exist in the file<br></div><div dir="ltr" id="yui_3_16_0_ym19_1_1475755398051_260144">and is not recognised as a supported dataset name.</div><div dir="ltr" id="yui_3_16_0_ym19_1_1475755398051_260145"><br id="yui_3_16_0_ym19_1_1475755398051_260146"></div><div dir="ltr" id="yui_3_16_0_ym19_1_1475755398051_260147">gdalinfo failed - unable to open 'HDF5:c:\pathToFile\filename.h5://ImageData/h2'.</div><div dir="ltr" id="yui_3_16_0_ym19_1_1475755398051_260147"><br></div><div dir="ltr" id="yui_3_16_0_ym19_1_1475755398051_260147">We know h2 exists because it was listed in gdalinfo for the filename.</div><div dir="ltr" id="yui_3_16_0_ym19_1_1475755398051_260147"><br></div><div dir="ltr" id="yui_3_16_0_ym19_1_1475755398051_260147">Thanks,</div><div dir="ltr" id="yui_3_16_0_ym19_1_1475755398051_260147">Michele</div><div dir="ltr" id="yui_3_16_0_ym19_1_1475755398051_260147"><br></div><div class="yahoo_quoted" id="yui_3_16_0_ym19_1_1475755398051_258728" style="display: block;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;" id="yui_3_16_0_ym19_1_1475755398051_258727"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;" id="yui_3_16_0_ym19_1_1475755398051_258726"> <div dir="ltr" id="yui_3_16_0_ym19_1_1475755398051_258725"> <font size="2" face="Arial" id="yui_3_16_0_ym19_1_1475755398051_258724"> <hr size="1" id="yui_3_16_0_ym19_1_1475755398051_258723"> <b id="yui_3_16_0_ym19_1_1475755398051_260107"><span style="font-weight:bold;" id="yui_3_16_0_ym19_1_1475755398051_260106">From:</span></b> Even Rouault <even.rouault@spatialys.com><br> <b><span style="font-weight: bold;">To:</span></b> Michele <clearlymichele@yahoo.com> <br><b><span style="font-weight: bold;">Cc:</span></b> gdal-dev@lists.osgeo.org<br> <b><span style="font-weight: bold;">Sent:</span></b> Monday, October 10, 2016 9:44 AM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [gdal-dev] GDALOpenInternal Problem Opening specific HDF5 bands<br> </font> </div> <div class="y_msg_container" id="yui_3_16_0_ym19_1_1475755398051_258732"><br>Le lundi 10 octobre 2016 15:20:08, Michele a écrit :<div class="yqt8411580557" id="yqtfd23505"><br clear="none">> I'm trying to open an HDF5 file, specific bands, but GDAL is giving an<br clear="none">> error message: <br clear="none">> <br clear="none">> > "'HDF5:C:\pathToFile\pathToFile/filename.h5://ImageData/B4' does not><br clear="none">> > exist in the file system and is not recognized as a supported data set><br clear="none">> > name"<br clear="none">> <br clear="none">> I got the error message after the GDALOpenInternal call using<br clear="none">> CPLGetLastErrorMsg(). I can't step into GDALOpenInternal (with Visual<br clear="none">> Studio) because we don't have GDAL source cpp file; just h file that came<br clear="none">> with the package, unless I'm searching for the wrong file name. The string<br clear="none">> for the ConnectionString parameter for GDALOpenInternal is shown in the<br clear="none">> quotes above. I found [qgis polygonize error 4 "file does not exist in the<br clear="none">> file system"], but they said it was because of using non-ascii characters<br clear="none">> in file path string. I didn't see any other pertinent info on this error<br clear="none">> message. We need to access the specific band of the HDF5 file. I noticed<br clear="none">> that our slashes in the path are showing in different directions, but I'm<br clear="none">> not sure that would be the issue here. We have both windows and linux<br clear="none">> OS's. This error was seen on windows os. We used (gdalinfo.exe<br clear="none">> filename.h5) and do see that the B4 exists there. Using the string,<br clear="none">> HDF5:"C:\pathToFile\filename.h5"://ImageData/B2, didn't work for<br clear="none">> openInternal with GDAL.<br clear="none">> <br clear="none">> I saw (gdal.org/gdal_tutorial.html), which gives an example to open a band<br clear="none">> after a GDALOpen, but it seems that it's supposed to work with<br clear="none">> GDALOpenInternal also according to my co-workers. We just don't have a<br clear="none">> good example of the connection string to get it working with<br clear="none">> GDALOpenInternal since we don't have access to that part of the code that<br clear="none">> does it. They want me to focus on using GDALOpenInternal.<br clear="none">> <br clear="none">> I'm<br clear="none">> seeing lists.alioth.debian.org/pipermail/pkg-grass-devel/2012-November/…<br clear="none">> , which gives me hope, but doesn't have a good example. I saw this which<br clear="none">> could be an example, although it isn't using a path, but I'm not sure:<br clear="none">> gdalwarp HDF4_SDS:ASTER_L1B:"pg-PR1B0000-2002031402_100_001":2<br clear="none">> pg-PR1B0000-2002031402_100_001_2.tif<br clear="none">> <br clear="none">> My question is, what format for the connection string do I need to use<br clear="none">> GDALOpenInternal, if it's not what I show for the two things I tried<br clear="none">> above? </div><br clear="none"><br clear="none">You should try first <br clear="none"><br clear="none">gdalinfo c:\pathToFile\filename.h5<br clear="none"><br clear="none">and then, if that opens, try accessing the subdataset it will report. The <br clear="none">expected syntax is like HDF5:"c:\pathToFile\filename.h5":subdataset_name<br clear="none"><br clear="none">Since you seem to mention that the path contains non ASCII characters, I <br clear="none">wouldn't be surprise if that didn't work correctly on Windows. You should <br clear="none">perhaps try making sure your path is encoded in the current ANSI code page of <br clear="none">your system since that's probably what the HDF5 API expects.<br clear="none"><br clear="none">Would probably make sense for GDAL to recode from UTF-8 to current ANSI code <br clear="none">page automagically as it does in the XLS driver:<br clear="none"><br clear="none">#ifdef _WIN32<br clear="none"> if( CPLTestBool( CPLGetConfigOption( "GDAL_FILENAME_IS_UTF8", "YES" ) ) )<br clear="none"> pszName = CPLRecode( pszFilename, CPL_ENC_UTF8, CPLString().Printf( <br clear="none">"CP%d", GetACP() ) );<br clear="none"> else<br clear="none"> pszName = CPLStrdup( pszFilename );<br clear="none">#else<br clear="none"> pszName = CPLStrdup( pszFilename );<br clear="none">#endif<br clear="none"><br clear="none">That assumes that the accentued characters you need can be expressed in the <br clear="none">current ANSI code page, otherwise you'll have to move the file elsewhere<br clear="none"><br clear="none">Even<br clear="none"><br clear="none">-- <br clear="none">Spatialys - Geospatial professional services<br clear="none"><a shape="rect" href="http://www.spatialys.com/" target="_blank">http://www.spatialys.com</a><br><br></div> </div> </div> </div></div></body></html>