[Proj] Using libproj with array data

James Gallagher jhrg at mac.com
Thu Jul 6 11:28:19 EDT 2006


On Jul 5, 2006, at 9:24 PM, Anthony Dunk wrote:

> James,
>
> What you're trying to do sounds like re-projecting a grid. (A grid  
> just
> being a two dimensional array of values). I have written code to do
> this previously.

I think what I need is simpler, but maybe not. What I'm doing is  
writing a function that can be run by a data server that will return  
a region of interest. The ROI, suplied by a client, will specified by  
long/lat upper-left and lower-right corner points. What I need to get  
are the actual array indexes that correspond to those long/lat  
locations. For some of the data, the coverage is the 'global' (which  
means 80N to 80S and 180W to 180E) while for the rest it a smaller  
region.

Metadata associated with these data files are spotty and often  
somewhat odd. For example, one data set lists longitude as running  
from 20 to 380 degrees. Before I look more at libproj, I should ask  
if it will handle such oddities? I assume so, but ...

Thanks,
James


>
> To project a grid you basically have to perform a forward  
> projection of
> some points around the edge of the input grid and use these to compute
> the bounding rectangle in the new coordinate system. (Remember some
> projections will distort the shape of the grid).
>
> You then create an output grid in the new coordinate system with the
> appropriate dimensions.
>
> Finally you have to go through each cell in the output grid and use
> reverse projection to find the corresponding cell in the unprojected
> grid. Use grid interpolation to pick up the value you need to put in
> the output grid cell.
>
> There's probably already code in the public domain which uses PROJ to
> do this.
>
> Anthony.
>
> --- James Gallagher <jhrg at mac.com> wrote:
>
>> 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?
>>
>> Thanks,
>> James
>> --
>> James Gallagher                jgallagher at opendap.org
>> OPeNDAP, Inc                   406.723.8663
>>
>> _______________________________________________
>> Proj mailing list
>> Proj at lists.maptools.org
>> http://lists.maptools.org/mailman/listinfo/proj
>>
>
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
> _______________________________________________
> Proj mailing list
> Proj at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/proj

--
James Gallagher                jgallagher at opendap.org
OPeNDAP, Inc                   406.723.8663



More information about the Proj mailing list