How to normalize Decimal Degree coordinates


Summary This topic shows how to use the Defense Solutions API to normalize a Decimal Degree (DD) coordinate and display the result.

Many of the ArcGIS Military Analyst and MOLE extension application programming interface (API) objects you have used in the past have equivalent or near equivalent objects in the ArcGIS 10 ArcObjects API. These new objects should now be used and do not require a Military Analyst extension or MOLE extension license. See Migrating from Military Analyst and MOLE for information on how to accomplish tasks in ArcGIS 10 that previously required the Military Analyst and MOLE APIs.
How to use:
 
  1. In your project, add a reference to the ESRI Defense Solutions jar.
  2. Copy and paste the sample code into your project.
  3. Compile and run your project.
[Java]
public void normalizeDD(){
    try{
        DDCoordinate ddCoord = new DDCoordinate();
        String dd;

        ddCoord.putCoords(10,  - 12); // put an x, y value
        dd = ddCoord.getString(); // get a string
        System.out.println("Input (X, Y): (10, -12)");
        System.out.println("Output (normalized string): " + dd + '\n');

        ddCoord.setString("S12 E10"); // put a string
        dd = ddCoord.getString(); // get the normalized string
        System.out.println("Input (string): (\"S12 E10\")");
        System.out.println("Output (normalized string): " + dd);
    }
    catch (IOException ex){
        ex.printStackTrace();
    }
}


See Also:

Defense Solutions Library Reference - Converting Coordinates
Defense Solutions Coordinate API Input-Output Formats
Sample: How to convert DMS to DD
Sample: How to convert coordinate arrays
Sample: How to convert from MGRS in Indian 1960 (ING-A) to Lat-Lon (DMS and DD) in WGS 1984




Development licensing Deployment licensing
Engine Developer Kit: Military Analyst Engine Runtime: Military Analyst