Esri / military-tools-geoprocessing-toolbox

military-tools-geoprocessing-toolbox is a collection of models, scripts, and tools for use in ArcGIS for Desktop and ArcGIS Pro. This toolbox is one component that is a part of Military Tools.
Apache License 2.0
33 stars 14 forks source link

Convert Coordinates script output is Text Data Type; therefore, not able to be used to 'Display XY Data' #407

Closed lfunkhouser closed 5 years ago

lfunkhouser commented 5 years ago

From @nfeuerstein on September 25, 2018 21:27

Steps to reproduce:

  1. Bring in table with MGRS field
  2. Use Convert Coordinates script to convert MGRS coordinates to other coordinate formats
  3. Attempt to use 'Display XY Data' to add data to map.

You will be unable to use the 'Display XY Data' with the fields that were the output of the Convert Coordinates script because they're in Text format.

@lfunkhouser

Copied from original issue: Esri/coordinate-conversion-addin-dotnet#521

lfunkhouser commented 5 years ago

From @topowright on October 15, 2018 13:2

@lfunkhouser this should be moved to the gp repo.

mfunk commented 5 years ago

Output type can be changed for decimal degrees by using the "DD_NUMERIC" keyword for Convert Coordinate Notation.

In ConvertCoordinates.py lines 144 to 151 denote the notation types...

        # {"format":"field_name(s)", ...}
        notationsToAdd = {"DD":"DDLat; DDLon",
                          "DDM":"DDMLat; DDMLon",
                          "DMS":"DMSLat; DMSLon",
                          "UTM_BANDS":"UTM_BANDS",
                          "MGRS":"MGRS",
                          "USNG":"USNG",
                          "GARS":"GARS",
                          "GEOREF":"GEOREF"}

Change the "DD" to "DD_NUMERIC"

        # {"format":"field_name(s)", ...}
        notationsToAdd = {"DD_NUMERIC":"DDLat; DDLon",
                          "DDM":"DDMLat; DDMLon",
                          "DMS":"DMSLat; DMSLon",
                          "UTM_BANDS":"UTM_BANDS",
                          "MGRS":"MGRS",
                          "USNG":"USNG",
                          "GARS":"GARS",
                          "GEOREF":"GEOREF"}

Probably a good idea to add a unit test to check for output field types at this point too.

csmoore commented 5 years ago

@mfunk 's suggested solution works well (thanks for that), so my question is do you want to

  1. Replace the existing DDLat, DDLon with this numeric format
  2. Add 2 new columns to the output (something like DDLatNumeric, DDLonNumeric)?

@lfunkhouser @dfoll @BobBooth

Original output (with hemisphere character): image

New output (numeric format): image

BobBooth commented 5 years ago

I'd vote to add DDLatNumeric and DDLonNumeric, but keep the string values too.

csmoore commented 5 years ago

Unfortunately it looks like those output field names "DDLat" "DDLon" are hard-coded in the System Convert Coordinate Notation tool, so it doesn't seem possible to have 2 DD outputs (DD, DD_NUMERIC) in the same table, so we may have to go with option 1, but looking into this further...

mfunk commented 5 years ago

@csmoore If you don't like the field that the system tool gives you, change it in the CC tool. Add your own field, copy values from original field to the new one, then delete the original. Basically the same thing we do with the 'gridcode' field for any of the Raster To Feature tools.

csmoore commented 5 years ago

Addressed in PR #405 - adds numeric lat/lon to conversion outputs (screenshots of ArcMap + Pro after change/PR below):

image

image

BobBooth commented 5 years ago

Ran tool on EnemyLocationsDD.csv, MontereyPointsOfInterest.csv, TabletoPoint.csv. Tested with input coordinates of DD (text), DD(numeric), MGRS. Tool ran correctly and produced outputs, which had all the output fields, including the new ones DDLatNumeric and DDLongNumeric, as well as the text DDlat and DDLon.

BobBooth commented 5 years ago

Created PR to update What's New page: https://github.com/ArcGIS/arcgis-solutions-website/pull/7634 Update has been made in CMS, and MT pages & PDFs republished.

BobBooth commented 5 years ago

This change is now visible in dev version of solutions pages on the What's New and Military Tools for ArcGIS 3.4 pages.