Cassanova, Bill wrote:
There is now an additional wrinkle to the project.  We need to now
extract the 4 closest values for a given lat-lon point
to complete a bilinear interpolation for added accuracy.

Would the correct method be:

(1)  Use the suggestion that Frank made below about a hybrid approach to
my original (2).  From this value I can easily determine the 4 closest
neighbors in raster space.  Since I need to know the distance between my
original query point and these 4 corner points I could create a reverse
transformation and push the 4 corner points back through the reverse
transformation and extract the lat-lon to calculate distance.

Bill,

Normally you would transform your one sample point back to source
raster space, and use that to identify the four nearest pixels.
But you can normally interpolate based on the distance in raster
space, so there should be no need to forward transform those points.

For instance, if the location transforms back to (5.25,7.0) in source
raster space you would want pixels (4,6), (5,6), (4,7), (5,7).  For
distance purposes the location of a pixel is it's center so, for instance,
the (4,6) pixel is really at (4.5,6.5) and the distance in x would be
0.75, and in y would be 0.5), etc.

It would seem as rich as GDAL is that there may be a better way to do
this but perhaps not.

In a second related question.  Has a book ever been produced by anyone
that describes "GDAL cookbook" type of solutions?  It would seem that
the type of question I am asking come up often and a book written to an
audience that includes both GIS professionals as well as general
programmers with limited GIS knowledge would be helpful.

There are a few books with some material on GDAL.  Tyler's Web Mapping
Illustrated and Gary's Desktop GIS book come to mind. But I believe they
are both focused on the commandline tools, not the programming api.

Sometimes the samples directories for the different scripting languages
can be a good source of programming ideas.

Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, [email protected]
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
[email protected]
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to