From: David Benigni To: torresjuanca@HOTMAIL.COM ; jnstone@U.WASHINGTON.EDU Subject: Getting Lat/Lon in Projected View in ArcView Date: Monday, March 29, 1999 6:09 AM Jenny/Juan, The following is a script that I use to return lat/lon position and display it in the message area at the bottom of the window. I attached this script to the pointer tool within the View. Also, it can display the lat/lon position in one of 3 formats: 1) Decimal Degrees - DDD.DDDDD 2) Degrees Minutes - DDD MM.MMMM 3) Degrees Minutes Seconds - DDD MM SS.SSS NOTE: This script only runs when you click the left mouse button within the View (after you have selected the pointer tool). It does not run constantly as you drag the mouse across the View. I have tried this in the past and I managed to constantly kill my ArcView session! ------------------------------------------------------------------------ 'Script: SelectPoint 'Description: Once the user clicks on the left mouse button when the ' View select tool is selected, the lat/lon position will be ' displayed in the message window at the bottom of the ' screen theView = av.GetProject.FindDoc("Trackline") _mapProj = theView.GetProjection p = theView.GetDisplay.ReturnUserPoint.ReturnUnprojected(_mapProj) x = p.GetX y = p.GetY ' only display lat/lon position if it's valid if ((x.Abs < 180) And (y.Abs < 90)) then if (x < 0) then x = x.Abs lonsuffix = "W" else lonsuffix = "E" end if (y < 0) then y = y.Abs latsuffix = "S" else latsuffix = "N" end if (_pointFormat = 1) then lon = x.SetFormat("ddd.ddddd") lat = y.SetFormat("dd.ddddd") msg = ("Selected Position = "+lon.AsString+lonsuffix+", "+lat.AsString+latsuffix) elseif (_pointFormat = 2) then londeg = x.Truncate.SetFormat("ddd.") lonmin = (x - londeg) * 60 latdeg = y.Truncate.SetFormat("dd.") latmin = (y - latdeg) * 60 msg = ("Selected Position = "+londeg.AsString+" "+lonmin.AsString+lonsuffix+", "+latdeg.AsString+ " "+latmin.AsString+latsuffix) else londeg = x.Truncate.SetFormat("ddd.") seconds = ((x - londeg) * 3600) lonmin = (seconds / 60).Truncate.SetFormat("dd.") lonsec = (seconds - (lonmin * 60)).SetFormat("dd.ddd") latdeg = y.Truncate.SetFormat("dd.") seconds = ((y - latdeg) * 3600) latmin = (seconds / 60).Truncate.SetFormat("dd.") latsec = (seconds - (latmin * 60)).SetFormat("dd.ddd") msg = ("Selected Position = "+londeg.AsString+" "+lonmin.AsString+" "+lonsec.AsString+lonsuffix+", "+latdeg.AsString+ " "+latmin.AsString+" "+latsec.AsString+latsuffix) end av.ShowMsg(msg) end theView.Select ------------------------------------------------------------------------ ********************************* David Benigni Software Engineer Office Of NOAA Corps Operations 1315 East West Hwy., Room 12141 Silver Spring, MD 20910-3282 E-mail: David.Benigni@noaa.gov ICQ#: 13745074 Phone: (301) 713-3431 x199, x200 Fax: (301) 713-1578 *********************************