[Proj] Using libproj with array data

Eric Miller EMiller at dfg.ca.gov
Thu Jul 6 11:16:54 EDT 2006

If your corner coordinates aren't too far apart, then simple linear
interpolation will probably work fine to translate coordinates to array

Something like:

X_width = Abs( X1 - X0 ) / X_count   ; ( X0, Y0 ) minimum x/y 
Y_width = Abs( Y1 - Y0 ) / Y_count   ; ( X1, Y1 ) maximum x/y

i = Floor( (Xi - X0) / X_width )   ; ( Xi, Yi ) the coordinate of
j = Floor( (Yi - Y0) / Y_width )

(Assumes X0 <= Xi < X1 and Y0 <= Yi < Y1) 

>>> jhrg at mac.com 7/5/2006 1:37:56 PM >>>
Hi, I hope this is not a FAQ or covered in the existing docs; I've  
checked and apologize if I missed something obvious.

I have a data server which is used to access a number of files of  
georeferenced data stored in two dimentional arrays. For each array,  
I know the longitude and latitude values at the corners as well as  
the projection and datum. Is there a way I can use libproj to map  
long/lat locations to indices within the arrays?

James Gallagher                jgallagher at opendap.org
OPeNDAP, Inc                   406.723.8663

Proj mailing list
Proj at lists.maptools.org 

More information about the Proj mailing list