Re: coordinates on land [message #18216 is a reply to message #18177] |
Thu, 09 December 1999 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Klaus Scipal (kscipal@ipf.tuwien.ac.at) writes:
> I am looking for an IDL procedure that tells me if a point (given in
> longitude and latitude) is situated on land or on water.
> for example the point 10�N and 20�E is situated on land (in Africa) the
> point 10�N 40�W is situated on water (the Atlantic)
Here is something quick and dirty. Returns a 1 if the location
is on land and a 0 otherwise.
Cheers,
David
--
FUNCTION On_Land, longitude, latitude
; Longitude ranges from -180 to 180.
; Latitude ranges from -90 to +90.
On_Error, 1
IF N_Params() NE 2 THEN Message, 'Incorrect number of arguments'
; Fill window with map continents. Water = 0, Land = 1.
Window, XSize=360, YSize=180, /Free, /Pixmap
Map_Set, /Cylindrical, 0, 0, Position=[0,0,1,1], /NoBorder, Color=0L
Map_Continents, /Fill, Color=1L
image = TVRD()
; Convert location to device coordinates.
location = Convert_Coord(longitude, latitude, /Data, /To_Device)
; Delete window. Return location pixel value.
WDelete, !D.Window
RETURN, image[0 > location[0] < 359, 0 > location[1] < 179]
END
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|