[gdal-dev] georeferencing / reprojecting HDF/GTiff
Frank Warmerdam
warmerdam at pobox.com
Sat Feb 16 10:45:32 EST 2008
mattia wrote:
> Hello all,
>
> My current problem is one of reprojecting an HDF4 image dataset onto a
> specific CRS.
> The data I have represent China, for this reason (ie: huge world area
> extent) I will be reprojecting directly onto WGS84 latidute and
> longitude system..
>
> My first question is: Can I achieve this reprojection from a Tiff file
> obtained from the HDF by gdal_translate (eg: an RGB image using 3
> bands)? Or can I solely do this by using the HDF4 dataset?
>
> Note: the output from gdalinfo on the HDF file reveals the two datasets
> "Latitude" and "Longitude" (subsets 11 & 12, I attach in this email
> gdalinfo.out which shows the whole output of the command)
>
> The metadata also contains the corner coordinates of the image in
> lat/long degrees:
> EASTBOUNDINGCOORDINATE=134.930768655651
> WESTBOUNDINGCOORDINATE=88.3307203917252
> NORTHBOUNDINGCOORDINATE=64.7989342568829
> SOUTHBOUNDINGCOORDINATE=20.7060304288409
>
>
> Before I start trying with gdalwarp (and any suggestions would be well
> appreciated on how I should compose the command) I would just like to
> clear up on a few confusions that I have.
>
> The main one is that I dont know whether I need to somehow extract GCPs
> out of the geo metadata in order to do the reprojection and how these
> would come into play anyhow..
Mattia,
In theory you could just derive four GCPs from the corner points in
the GRINGPOINTLATITUDE/GRINGPOINTLONGITUDE metadata. But I imagine
this would not be very precise given the large region covered.
You could inspect the latitude and longitude SDS'ses and derive
GCPs from them. This was the traditional approach I used with datasets
like this.
The newer approach is to treat those subdatasets as "geolocation arrays".
The HDF4 driver will do this automatically for some products where
it recognises the geolocation arrays for what they are. But apparently
this product is not recognised. Actually, to confirm that you
would need to do a gdalinfo report on subdataset like:
HDF4_SDS:UNKNOWN:"AMOD021KM20070104035343.hdf":0
If the driver doesn't recognise the geolocation arrays, it is still
possible to setup the relationships manually using a VRT file but it
is quite complicated. I'm not willing to spend the time to explain
how this morning, but if you read the RFC on geolocation arrays, and
the tutorial on VRT files you might have enough info to see how to
piece it together.
The gdalwarp program (in 1.5) should support using geolocation arrays
for a warp, though it may used quite a lot of memory to do so.
> Another important thing is also that when I use gdal_translate to
> convert to a GTiff format, if I add in the creation option -co
> "TFW=YES", I will never get a World file with the georeferencing
> information.. Any idea why this could be? I guess it could be because
> the data is still in raw/swath format and cannot allow creation of a
> georeferencing TFW file... but I am not sure about this yet..
Right, if there is no geotransform available then no .tfw is written
regardless of the tfw setting.
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 | President OSGeo, http://osgeo.org
More information about the gdal-dev
mailing list