[gdal-dev] BSB GDALGCPsToGeoTransform() failing

Frank Warmerdam warmerdam at p...
Thu Nov 7 09:05:57 EST 2002


Jay Borseth wrote:
> Standard Disclaimer: I don't know nuttin about GDAL, but...
> 
> When opening BSB version 3.07 files I'm noting a failure in
> GDALGCPsToGeoTransform() (in gdal_misc.cpp, line 1432) when the sanity
> check is performed on the GCPs:
...
> And since the failure tolerance is a quarter pixel, upon return to
> bsbdataset.cpp V1.7, line 316, bGeoTransformSet is set false, and not
> much works after that.
> 
> I'm assuming this problem is intrinsic to the way the BSB files were
> created. One fix would be to pass "true" as the final parameter to
> GDALGCPsToGeoTransform() which just bypasses the sanity check, but this
> seems less than ideal. What to do?

Jay,

BSB files use a series of reference points on the map to describe the
georeferencing. If the map is scanned from a slightly warped paper map, or
if the underlying map is not really sampled on a geographic grid, then it will
be essentially impossible to compute an affine transform describing the
georeferencing of the image.

The error test is intended to check if an affine transform is a good
approximation of the georeferencing. The error size check (one quarter
pixel) is somewhat arbitrary. You could alter that to a whole pixel if you
like, but I have personally yet to check a BSB file that came even that
close!

However, you can get the underlying GCPs (ground control points) from the
GDAL API, and use them yourself to georeference the image, even calling
GDALGCPsToGeoTransform() with TRUE passed if you wish. This would be
my suggestion.

Best regards,

-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam at p...
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