Large decimal degree values when calculating geometry for latitude and longitude

3262
11
09-24-2020 11:19 AM
BrentDavis
New Contributor II

Often we need to edit a polygon feature and recalculate a longitude and latitude field for the centroid of the feature.  Historically, we have been doing this editing calculation within arcmap, but have been trying it out in ArcGIS pro.

Unfortunately when we try and calculate the centroid x-coordinate and centroid y-coordinate for longitude and latitude in decimal degrees we are getting very large values as compared to the workflow used in arcmap.  It looks like the format is being displayed in meters.

Below are the setting we are using:

Here is the output of (Lat,Lon) for a test feature that was created.

Any ideas on how to reproduce the calculate geometry function from arcmap?

Thanks

0 Kudos
11 Replies
ABishop
MVP Regular Contributor

@DanPatterson 

I know this post is from over a year ago, but it is the only one that is similar to what I am dealing with currently in a model that I have built for calculating geometry attributes in an acreage field for our parcel polygons.  I have another post out there where a gentleman is trying to assist me, but he isn't clarifying on how or where to effectively round the decimal to 2 in my model script.  Could you possibly assist me with this Dan?  Any help you can offer will be GREATLY appreciated!  See the model script in the python window below.

# -*- coding: utf-8 -*-
"""
Generated by ArcGIS ModelBuilder on : 2021-09-30 10:58:27
"""
import arcpy

def GeometryCalc():  # GeometryCalc

    # To allow overwriting outputs change overwriteOutput option to True.
    arcpy.env.overwriteOutput = False

    arcpy.ImportToolbox(r"c:\program files\arcgis\pro\Resources\ArcToolbox\toolboxes\Data Management Tools.tbx")
    # Model Environment settings
    with arcpy.EnvManager(scratchWorkspace=r"C:\Users\abishop\AppData\Local\Temp\ArcGISProTemp10544\1ba0f558-c873-4c6c-be6d-dc08393016c0\Default.gdb", workspace=r"C:\Users\abishop\AppData\Local\Temp\ArcGISProTemp10544\1ba0f558-c873-4c6c-be6d-dc08393016c0\Default.gdb"):
        mcpagis_DBO_Parcels = "K:\\GIS_TOOLS\\DB\\merlin.sde\\mcpagis.DBO.Cadastre__Features\\mcpagis.DBO.Parcels"

        # Process: Make Feature Layer (Make Feature Layer) (management)
        DBO_Parcels_Layer = "DBO.Parcels_Layer"
        with arcpy.EnvManager(scratchWorkspace=r"C:\Users\abishop\AppData\Local\Temp\ArcGISProTemp8392\0686a1b7-5a62-4965-97f7-463b179295c6\Default.gdb", workspace=r"C:\Users\abishop\AppData\Local\Temp\ArcGISProTemp8392\0686a1b7-5a62-4965-97f7-463b179295c6\Default.gdb"):
            arcpy.management.MakeFeatureLayer(in_features=mcpagis_DBO_Parcels, out_layer=DBO_Parcels_Layer, where_clause="GIS_ACRES = 0 Or GIS_ACRES IS NULL", workspace="", field_info="OBJECTID OBJECTID VISIBLE NONE;PARCEL PARCEL VISIBLE NONE;PREFIX PREFIX VISIBLE NONE;SUFFIX1 SUFFIX1 VISIBLE NONE;SUFFIX2 SUFFIX2 VISIBLE NONE;GIS_ACRES GIS_ACRES VISIBLE NONE;KIND KIND VISIBLE NONE;ANGLE ANGLE VISIBLE NONE;SIZE_ SIZE_ VISIBLE NONE;DATE_CREATED DATE_CREATED VISIBLE NONE;DATE_UPDATED DATE_UPDATED VISIBLE NONE;SHAPE SHAPE VISIBLE NONE;SHAPE.area SHAPE.area VISIBLE NONE;SHAPE.len SHAPE.len VISIBLE NONE")

        # Process: Calculate Geometry Attributes (Calculate Geometry Attributes) (management)
        with arcpy.EnvManager(scratchWorkspace=r"C:\Users\abishop\AppData\Local\Temp\ArcGISProTemp8392\0686a1b7-5a62-4965-97f7-463b179295c6\Default.gdb", workspace=r"C:\Users\abishop\AppData\Local\Temp\ArcGISProTemp8392\0686a1b7-5a62-4965-97f7-463b179295c6\Default.gdb"):
            DBO_Parcels_Layer_2_ = arcpy.management.CalculateGeometryAttributes(in_features=DBO_Parcels_Layer, geometry_property=[["GIS_ACRES", "AREA"]], length_unit="", area_unit="ACRES", coordinate_system="PROJCS[\"NAD_1983_StatePlane_Florida_West_FIPS_0902_Feet\",GEOGCS[\"GCS_North_American_1983\",DATUM[\"D_North_American_1983\",SPHEROID[\"GRS_1980\",6378137.0,298.257222101]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"False_Easting\",656166.6666666665],PARAMETER[\"False_Northing\",0.0],PARAMETER[\"Central_Meridian\",-82.0],PARAMETER[\"Scale_Factor\",0.9999411764705882],PARAMETER[\"Latitude_Of_Origin\",24.33333333333333],UNIT[\"Foot_US\",0.3048006096012192]]", coordinate_format="SAME_AS_INPUT")[0]

if __name__ == '__main__':
    GeometryCalc()
Amanda Bishop, GISP
0 Kudos
SUSANMYERS
New Contributor III

Hi Dan,

When calculating geometry for latitude and longitude fields, ArcGIS Pro 3.03 gives me eight decimals:  DDMMSS.ssssssss

I guess someone in the world wants that, but we just want DDD° MM' SSS.sss (like the good old days in ArcGIS Desktop).  Choosing WGS84 vs. a state plane coordinate system does not appear to affect this.  

We are choosing the following option for coordinate format:  (Degrees Minutes Seconds (DDD° MM' SSS.ss" <N|S|E|W>)

While I am asking, perhaps there is a way to add these fields so that they automatically update when points are added to the table?

0 Kudos