HOW TO

Add items for Degrees, Minutes and Seconds to a Geographic point coverage

Last Published: April 25, 2020

Summary

This AML will add items for Degrees, Minutes and Seconds for all the points in a geographic coverage in decimal degrees.

Procedure



  • Make sure the coverage is in Geographic DD projection.
  • Run the Arc ADDXY command on the coverage.
  • Run this aml:

    Code:
    /* dd2dms.aml 1.0 Nov 15, 99 12:30 pm

    /* You may use, copy, modify, merge, distribute, alter, reproduce
    /* and/or create derivative works of this AML for your own internal
    /* use. All rights not specifically granted herein are reserved to
    /* ESRI.
    /*
    /* THIS AML IS PROVIDED "AS-IS" WITHOUT WARRANTY OF ANY KIND, EITHER
    /* EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
    /* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE,
    /* WITH RESPECT TO THE AML.
    /*
    /* ESRI shall not be liable for any damages under any theory of law
    /* related to your use of this AML, even if ESRI is advised of the
    /* possibilities of such damage. This AML is not supported by ESRI.

    /*********************************************************************/
    /* NAME: dd2dms.aml */
    /* PURPOSE: Generates items containing X and Y coordinates in */
    /* units of Degrees, Minutes and Seconds. */
    /* COMMENTS: It is assumed the coverage is in Geographic */
    /* DD projection, and the ADDXY command has been run on */
    /* it. The program takes a coverage name as input. It */
    /* will write 6 new items to the coverage containing the */
    /* values for degrees, minutes and seconds. It will */
    /* truncate the values for the seconds, so some */
    /* modifications will be necessary if this is not a */
    /* desired option. */
    /* Usage: DD2DMS <in_coverage> */
    /*********************************************************************/

    &args cov

    &messages &off

    additem %cov%.pat %cov%.pat xdeg 4 5 b
    additem %cov%.pat %cov%.pat xmin 4 5 b
    additem %cov%.pat %cov%.pat xsec 4 5 b
    additem %cov%.pat %cov%.pat ydeg 4 5 b
    additem %cov%.pat %cov%.pat ymin 4 5 b
    additem %cov%.pat %cov%.pat ysec 4 5 b

    &type Converting...

    cursor cur1 declare %cov%.pat info rw
    cursor cur1 open

    /* skip first entry - universe poly
    cursor cur1 next

    &do &while %:cur1.AML$NEXT%
    &sv xcoord = %:cur1.X-COORD%
    &sv xd = [truncate %xcoord%]
    &sv fraction = [calc [abs %xcoord%] - [abs %xd%]]
    &sv xm = [truncate [calc %fraction% * 60 ]]
    &sv xs = [truncate [calc ( ( %fraction% ) - ( %xm% / 60 ) ) * 3600 ]]
    &sv :cur1.xdeg = %xd%
    &sv :cur1.xmin = %xm%
    &sv :cur1.xsec = %xs%

    &sv ycoord = %:cur1.Y-COORD%
    &sv yd = [truncate %ycoord%]
    &sv fraction = [calc [abs %ycoord%] - [abs %yd%]]
    &sv ym = [truncate [calc %fraction% * 60 ]]
    &sv ys = [truncate [calc ( ( %fraction% ) - ( %ym% / 60 ) ) * 3600 ]]
    &sv :cur1.ydeg = %yd%
    &sv :cur1.ymin = %ym%
    &sv :cur1.ysec = %ys%

    cursor cur1 next
    &end
    &echo &off
    cursor cur1 close
    cursor cur1 remove

    &type Done
    &messages &on

    &return

Article ID:000002069

Software:
  • Legacy Products

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Discover more on this topic