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 #79009 is a reply to message #79008] Wed, 25 January 2012 19:37 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
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]

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
[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 10:37:47 PDT 2025

Total time taken to generate the page: 1.36187 seconds