IndustryCommunity.com > Electrical and Electronic Community > Optical Instrumentation & Optics Forum > Message
##### Find

[ List Subjects ][ Post Message ]
[ View Followups ][ Post Followup ]

Subject: Re: latitude & longitude to XY coordinate conversion.

Date: 12/26/02 at 6:45 AM
Posted by: PIER
E-mail: pier@up369.com
Message Posted:

In Reply to: latitude & longitude to XY coordinate conversion. posted by Ms dutta on 04/17/01 at 3:34 AM:

Support Forums (http://www.bossintl.com/forums/forums.html)- Surfer (http://www.bossintl.com/forums/forumdisplay.php?forumid=17)-- How do I display the scale bar in miles or kilometers when the XY coordinates are in (http://www.bossintl.com/forums/showthread.php?threadid=9495)--------------------------------------------------------------------------------Posted by Support Staff on 10-30-2001 08:09 PM: How do I display the scale bar in miles or kilometers when the XY coordinates are inFirst convert the map X Scale and Y Scale to Cartesian coordinates (i.e. miles, feet, kilometers, meters), because one degree of latitude does not cover the same number of miles as one degree of longitude. For an approximate conversion from latitude and longitude degrees to miles or kilometers, use the following formulas for a spherical projection: 1 degree latitude = 110.6 km = 68.703 mi 1 degree longitude = 111.3km * cos(latitude) = 69.172mi * cos(latitude) To set the scale bar of a map, use the formulas to convert latitude and longitude to the desired coordinates. For the map of Nevada USA included with Surfer (nv.gsb) the center of the map is approximately (-117, 39). Using the formulas: 1 degree latitude = 68.703 miles 1 degree longitude = 69.172 * cos(39) = 53.757 miles To set the X and Y to the same scale in miles, select the map and choose the Map | Scale menu. Disable the Proportional XY Scaling checkbox in the lower left corner of the Scale dialog box. If the X scale is set to 1.0 in = 1 Map units (degrees longitude), calculate the ratio of X to Y as 53.757mi / 68.703mi = 0.78245. Specify the Y scale as 1.0 in = 0.78245 Map Units. The default scale bar is created in degrees with a Cycle Spacing = 1 and Label Increment = 1. To change the scale bar to 50 mile increments, change the Cycle Spacing to 50mi / 53.757mi per degree or 0.93 (degrees) and the Label Increment to 50 (miles). Q. How do I run a Surfer 6 script in Surfer 7? A. Surfer 7 Scripter conforms to the industry standard Visual Basic syntax and requires several changes from the older Surfer 6 Scripter. We recommend converting the script to Surfer 7 format, since support for the Surfer 6 format may be phased out in future versions of Surfer. As a temporary workaround, there are several possible ways to run a Surfer 6 script. If you have Surfer 6 and Surfer 7, run the script in the Surfer 6 Scripter program. This method may require minor changes (Surfer 6 Surface Map = Surfer 7 Wireframe Map), but most commands will work without change. If you do not have the Surfer 6 Scripter program, more extensive changes are needed to run a Surfer 6 script in Surfer 7 Scripter. In addition to the changes listed in the Surfer 7 readme.txt file, help, and user's guide, note the following: The Surfer 6 Scripter time\$() and date\$() functions display an error message in Surfer 7 Scripter: "Function is defined with a different value type." Use the Surfer 7 Scripter functions time() and date(), or time and date with no parentheses (no \$). The Surfer 6 Scripter sleep() function is not supported in Surfer 7 Scripter, which displays the message "Expecting an existing scalar var". Use the Surfer 7 Scripter wait() function, or wait without parentheses. The Surfer 6 Scripter function cls() to clear the output window is not supported in Surfer 7 Scripter. Surfer 7 Scripter uses If .. End If (note space in End If). Surfer 6 Scripter uses If .. Endif (no spaces in Endif). Attempting to run a script in Surfer 7 Scripter with Endif displays the error message "Expecting an existing scalar var". Surfer 7 Scripter does not permit the use of variable type suffixes (%, \$, #, ?, &, @, !) in the DIM declaration in combination with the text As Type, but Surfer 6 Scripter does permit it. Surfer 7 Scripter: 'Declare a As String DIM a As String 'Declare b\$ As String DIM b\$ '"ERROR Unexpected Text" in next statement. DIM c\$ as String Surfer 6 Scripter: 'Declare a As String DIM a As String 'Anything without "As" is declared as Double DIM b\$ 'Declare c\$ as String DIM c\$ As String Surfer 7 Scripter treats a variable with a suffix as the same variable without the suffix, and Surfer 6 treats them as different variables. Surfer 7 Scripter DIM a As String a = "Text1" a\$ = "Text2" Debug.Print a\$;" ";a 'Prints "Text2 Text2", a\$ = a Surfer 6 Scripter DIM a As String DIM a\$ As String a = "Text1" a\$ = "Text2" print a;" ";a\$ 'Prints "Text1 Text2", a\$ a--------------------------------------------------------------------------------The time now is 06:33 AM ESTFROMhttp://www.bossintl.com/forums/printthread/threadid/9495.htmlPier CHINAPier@up369.com

 Name: E-Mail: Subject:

Message to Post: