[gdal-dev] General Questions about gdal usage with Grib1 Data Set
BCassanova at weather.com
Tue Jul 21 16:08:35 EDT 2009
I had considered that but was a little concerned about accuracy. So for
Original lat-lon point --> -77.78, 36.01
Extracted i-j --> 1015.63, 404.964
The 4 closest are the ceil/floor of both so:
1015 and 1016 for X and 404 and 405 for Y.
However, the resolution of the data is 12km. So. It would seem more
accurate to reverse transform the 1015 and 1016 and 404 and 405
Back to lat-lon, and then determine separation in degrees as opposed to
rounded off mid-points in raster space. Does this make sense or is my
relative newness to GIS beginning to show?
Regardless it seems like what I am suggesting should be possible is I
set up the backward projection correctly...Right?
From: Frank Warmerdam [mailto:warmerdam at pobox.com]
Sent: Tuesday, July 21, 2009 3:48 PM
To: Cassanova, Bill
Cc: gdal-dev at lists.osgeo.org
Subject: Re: [gdal-dev] General Questions about gdal usage with Grib1
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
> 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
> original query point and these 4 corner points I could create a
> transformation and push the 4 corner points back through the reverse
> transformation and extract the lat-lon to calculate distance.
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
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
> 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.
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