How To: Project Decimal Degree X/Y coordinate values
You can Project Decimal Degree coordinate points using Avenue. For example, suppose you have a table of DD coordinates that you want to overlay with a coverage in in a projected coordinate system. This document details how to project these coordinate values into UTM. The script below assumes that the table contains Decimal Degree values in separate X and Y fields and that the locations are somewhere in the Northern Hemisphere.
1. Paste the following code into a new script window.
2. Compile and run the script.
3. Select which UTM Zone you want the coordinates converted into.
4. Select the table that contains the Decimal Degree coordinates.
5. Select the X-longitude and the Y-latitude value fields.
'------------ DD2UTM.AVE ------------
'--- This script takes a table of points in DD and projects them
'--- into UTM coordinates for a user-defined Zone.
'-- Each UTM Zone has an X-coordinate which
'-- extends from 0 to 1,000,000 meters, where 500,000 is the false easting
'-- coordinate for the central meridian, although the actual coordinates
'-- rarely get as low as 0, nor as high as 1,000,000, otherwise the
'-- coordinates would actually fall into an adjacent UTM Zone.
'-- Each UTM Zone for the Northern Hemisphere has a Y-coordinate which
'-- extends from 0 at the equator to 10,000,000 meters at the North Pole.
'-- Hence, when I create the Rectangle below, the X extends from 0 to
'-- 1 million, and the Y extends from 0 to 10 million.
'-- Then the 'Trnmerc.Make' request turns the rectangle into a UTM
myRect = Rect.Make(0@0,1000000@10000000)
myUTM = Trnmerc.Make(myRect)
a = MsgBox.Input("Enter the UTM Zone into which"+NL+
"you want to project the points.",
if (a = nil) then
'-- Conversion factor to turn a UTM Zone into its Central Meridian
b = ((a.AsNumber * 6) - 183)
for each d in theDocList
end '-- is table
end '-- for each d
"Choose the table that contains the DD coord that you want to project",
if (theSelTab = nil) then
"Select the field which contains the X-longitude coordinate",
"Where is X?")
"Select the field which contains the Y-Latitude coordinate",
"Where is Y?")
"Save dBASE table file")
if (theNewFile = nil) then
for each rec in theVtab
t = Table.Make(theNewVTab)
'------------ End of Script ------------
You may want to modify this script so that it makes the user select a unique ID field from the first table in (A) above. This field can be cloned into the new table in Step 2, which then can be used as the basis for a one-to-one table join, where the new coordinate fields can be rejoined back to the original table.