HOW TO

# Project Decimal Degree X/Y coordinate values

Last Published: April 25, 2020

## Procedure

Summary

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.

Soulution

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.

`Code:'------------ 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 UTMmyRect = 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.","Zone Choice","")if (a = nil) thenreturn nilend'-- Conversion factor to turn a UTM Zone into its Central Meridianb = ((a.AsNumber * 6) - 183) myUTM.SetCentralMeridian(b)myUTM.SetFalseEasting(500000)myUTM.SetFalseNorthing(0)myUTM.SetReferenceLatitude(0)myUTM.SetScale(0.9996)theDocList=av.GetProject.GetDocstheTabList=List.Makefor each d in theDocList  if (d.Is(Table))    then      theTabList.Add(d)  end   '-- is tableend   '-- for each dtheSelTab=MsgBox.Choice(theTabList,"Choose the table that contains the DD coord that you want to project","Table Choice")if (theSelTab = nil) thenreturn nilendtheVtab=theSelTab.GetVTabtheFields=theVtab.GetFieldstheDDXfld=MsgBox.Choice(theFields,"Select the field which contains the X-longitude coordinate","Where is X?")theDDYfld=MsgBox.Choice(theFields,"Select the field which contains the Y-Latitude coordinate","Where is Y?")theNewDDXfld=Field.Make("XlongDD",#FIELD_DECIMAL,12,6)theNewDDYfld=Field.Make("YlatDD",#FIELD_DECIMAL,12,6)theNewUTMXfld=Field.Make("XlongUTM",#FIELD_DECIMAL,16,2)theNewUTMYfld=Field.Make("YlatUTM",#FIELD_DECIMAL,16,2)theNewFldList={theNewDDXfld,theNewDDYfld,theNewUTMXfld,theNewUTMYfld}theNewFile=FileDialog.Put("*.dbf".AsFileName,"dBASE Files","Save dBASE table file")if (theNewFile = nil) thenreturn nilendtheNewVTab=VTab.MakeNew(theNewFile,dBASE)theNewVTab.AddFields(theNewFldList)for each rec in theVtab  theDDXval=theVtab.ReturnValue(theDDXfld,rec)  theDDYval=theVtab.ReturnValue(theDDYfld,rec)  theNewrec=theNewVTab.AddRecord  theNewVTab.SetValue(theNewDDXfld,theNewrec,theDDXval)  theNewVTab.SetValue(theNewDDYfld,theNewrec,theDDYval)  theDDpoint=Point.Make(theDDXval,theDDYval)  myUTM.ProjectPt(theDDpoint)  theUTMXval=theDDpoint.GetX  theUTMYval=theDDpoint.GetY  theNewVTab.SetValue(theNewUTMXfld,theNewrec,theUTMXval)  theNewVTab.SetValue(theNewUTMYfld,theNewrec,theUTMYval)endt = Table.Make(theNewVTab)t.SetName(theNewVTab.GetName)t.GetWin.Opent.StopEditing'------------ End of Script ------------`

`Note: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.`

Article ID:000001477

Software:
• Legacy Products

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options