comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Find pixel based on latitude/longitude.
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Find pixel based on latitude/longitude. [message #79008 is a reply to message #79006] Wed, 25 January 2012 22:53 Go to previous messageGo to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
On Jan 25, 10:37 pm, David Fanning <n...@dfanning.com> wrote:
> Daniel Otis writes:
>> This is a very basic question, but I am struggling to find a good
>> solution. I have image arrays and want to find a pixel and a line
>> value based on a latitude and a longitude.
>
>> For example, a global SST array is 2D (8640x4320). I have a 1D array
>> of latitudes(4320) and 1D array of longitudes(8640). Based on depth
>> and other considerations, I have a latitude value and a longitude
>> value where I want to extract data and I need to find the closest
>> pixel.
>
>> I can't use a WHERE command because my desired lat/lon values don't
>> exactly correspond to those in the lat/lon arrays. I just want to find
>> the closest pixel in the 2D array based on the lat and lon that I
>> provide.
>
>> This seems simple, but I have not been able to find a good solution.
>> Any ideas are appreciated. Thanks.
>
> latindex = Value_Locate(lats, mylat)
> lonindex = Value_Locate(lons, mylon)
> valueIwant = image[lonindex, latindex]

David's method is "nearest neighbor" interpolation. If you want to
get slightly fancier, use linear interpolation with INTERPOLATE().

Craig
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Find pixel based on latitude/longitude.
Next Topic: Re: cgWindow Test Volunteers

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 22:04:11 PDT 2025

Total time taken to generate the page: 0.39658 seconds