comp.lang.idl-pvwave archive - RDF feed
type: channel
description: Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
items: Re: coordinates on land

Re: coordinates on land
type: item
description: 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
creator: davidf
date: 1999-12-09T08:00:00-00:00

Re: coordinates on land
type: item
description: Klaus Scipal <kscipal@ipf.tuwien.ac.at> wrote in message news:82p4ia$bf$1@news.tuwien.ac.at... > > 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) I'm not aware of any ready-to-run solution to this problem. The problem can be divided into two parts: 1.) Describe land areas as closed polygons. 2.) Establish if the point in question is inside any of the polygons. There was some discussion about part 2 on this newsgroup a few weeks ago. I posted some code based on summing angles around the point in question to the polygon vertices; several other people posted code or made suggestions. Re part 1, AFAIK the coastline datasets that come with IDL are not suitable because they contain duplicate points or intersecting edges. There is a coastline dataset designed specifically for this purpose, called "GSHHS - A Global Self-consistent, Hierarchical, High-resolution Shoreline Database", at http://www.ngdc.noaa.gov/mgg/shorelines/gshhs.html The GSHHS data come in a straightforward binary format. I intend to write IDL routines to read the GSHHS data REAL SOON NOW. --- Mark Hadfield m.hadfield@niwa.cri.nz http://katipo.niwa.cri.nz/~hadfield/ National Institute for Water and Atmospheric Research PO Box 14-901, Wellington, New Zealand
creator: Mark Hadfield
date: 1999-12-15T08:00:00-00:00