Recently I tried to calculate some point coordinates, I needed those coordinates in <N|S|E|W> DDD° MM' SSS.ss" format, but I realized that by default (even when the same tool shows as if it were to calculate <N|S|E|W> DDD° MM' SSS.ss") the calculation goes from SSS.ss to SSS.ssssss. unfortunately I just need to round my coordinates (the seconds) to 2 decimal places. So I had to calculate them in decimal coordinates (+/- DD.ddddddd) and obtain the coordinates through an attribute calculation rule.
As you may know this is a quite time consuming process so it would be helpful to add the possibility to change the desirec decimal places in "calculate geometry"
@EDUARDOARDILARINCON Checking into it. Tool doc suggests it should work.
Calculate Geometry Attributes (Data Management)—ArcGIS Pro | Documentation
Hi @JonathanNeal Thank for you reply! Due to your comment I've tried to claculate some coordinates again.
This is what I got:
Tool configuration:
Result:
As you can see in the result table, there are 8 decimal places even when the tool is supposedly configured to return only 2, I've tried to change the "SSS.ss" to "SSS.s" or "SSS.sss" manually in the coordinate format, but the tool doesn't run.
I highly appreciate if you have any idea in order to solve this.
Thanks!
arcpy.management.CalculateGeometryAttributes(
in_features="esriCampusSample_ExportFeatures",
geometry_property="LAT POINT_X;LON POINT_Y",
length_unit="",
area_unit="",
coordinate_system='GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]',
coordinate_format="DMS_DIR_LAST"
)
arcpy.management.CalculateFields(
in_table="esriCampusSample_ExportFeatures",
expression_type="PYTHON3",
fields="LAT two_decimal_second(!LAT!) #;LON two_decimal_second(!LON!) #",
code_block="""def two_decimal_second(coord):
parts = coord.split()
seconds = parts[2].split('.')
parts[2] = seconds[0] + '.' + seconds[1][0:2] + seconds[1][-1]
return ' '.join(parts)"""
)
@EDUARDOARDILARINCON Here you go. Here is a quick script to get your work done. We will update the doc to be more clear. The intent was that it would give decimal places, not that it would give exactly 2.
@EDUARDOARDILARINCON this is being resolved as a BUG in Pro 3.3.
The calculation is fixed to match the documented two decimal places for seconds and three decimal places for minutes.
DDD° MM' SSS.ss"
DDD° MM.mmm'
So no manual rounding will be required starting in 3.3. This request was made by many users who wanted the rounded value, and no one seems to need an option for the full 6+ digits, so to keep the tool from having yet another parameter, the seconds and minutes decimals are simply being corrected to match the documentation.
As noted, this was considered a bug, reported here https://support.esri.com/en-us/bug/the-coordinate-format-parameter-for-the-calculate-geome-bug-00016...
that is addressed in ArcGIS Pro 3.3 where the tool's behavior is corrected to match the documentation.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.