[gdal-dev] GetProjectionRef() returning NULL

Frank Warmerdam warmerdam at pobox.com
Mon May 9 12:55:14 EDT 2011


On 11-05-09 10:37 AM, Rodolfo Bonnin wrote:
> Hello all,
>
> I'm working with a HDF5 dataset with Gdal 1.8.0, I open it with the
> HDF5Image driver.
> The image metadata is read OK from what I can see, but when I want to
> execute the GetProjectionRef() method, it returns null, even if the
> documentation says it wouldn't return any null pointer.
>
> I've traced the null pointer to HDF5ImageDataset::CreateProjections(),
> in line 562 it reads
>
> _______________________________________________________________________
> poH5Objects=HDF5FindDatasetObjects( poH5RootGroup,  "Latitude" );
>      if( !poH5Objects ) {
> 	return CE_None;
>      }
> _______________________________________________________________________
>
> Since my HDF5 file doesn't have a "Latitude" dataset, the function
> returns without setting the pszProjection variable, it remains null
> and   is never being set as an empty string, as the GetProjectionRef
> consist only in:
> ________________________________________________________________________
> const char *HDF5ImageDataset::GetProjectionRef( )
>
> {
>      return pszProjection;  //
> }
> _______________________________________________________________________

Rodolfo,

I agree, this is a bug.  I have filed a ticket on the issue and applied a
fix in 1.8 and trunk.

   http://trac.osgeo.org/gdal/ticket/4076

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the gdal-dev mailing list