How do you calculate a point into decimal degres in ArcGIS Pro

8186
14
Jump to solution
04-17-2017 08:41 AM
AileenProfir
Occasional Contributor

I'm trying to use ArcGIS Pro to calculate the lat/long of a point in decimal degrees.  I must not be understanding the help section below.  In the calculate field I enter !SHAPE.FirstPoint.X@decimaldegrees! but it fails because decimaldegrees is not defined...

Usage

  • Python expressions can be created using properties from the Geometry object including type, extent, centroid, firstPoint, lastPoint, area, length, isMultipart, and partCount (for example, !shape.area!).

  • Python expressions can use the geometry area and length properties with an areal or linear unit to convert the value to a different unit of measure (for example, !shape.length@kilometers!).

    • Linear unit of measure keywords:
      • CENTIMETERS | DECIMALDEGREES | DECIMETERS | FEET | INCHES | KILOMETERS | METERS | MILES | MILLIMETERS | NAUTICALMILES | POINTS | UNKNOWN | YARDS
0 Kudos
14 Replies
SeanSummers_CC
Regular Contributor

I really appreciate your help.  I tried your tool but it failed and this is what I got:

Start Time: Thursday, July 20, 2017 8:56:42 AM
Running script UpdateLATLONG...
 WARNING 001097: LAT  already exists -- overwriting.
Failed script UpdateLATLONG...
Traceback (most recent call last):
  File "C:\Users\spsummers\Downloads\CalcGeometryModified\CalcGeometryModified.tbx#UpdateLATLONG_CalcGeometryModified.py", line 387, in <module>
  File "C:\Users\spsummers\Downloads\CalcGeometryModified\CalcGeometryModified.tbx#UpdateLATLONG_CalcGeometryModified.py", line 61, in execute
  File "C:\Users\spsummers\Downloads\CalcGeometryModified\CalcGeometryModified.tbx#UpdateLATLONG_CalcGeometryModified.py", line 313, in CreateOutputFields
RuntimeError: Table is already locked [Table is already locked[gis.GISDB.AddressPoints.LONG]]
Failed to execute (UpdateLATLONG).
Failed at Thursday, July 20, 2017 8:58:06 AM (Elapsed Time: 1 minutes 24 seconds)

I know some very basic python but this is a little over my head. 

0 Kudos
GünterDörffel
Frequent Contributor

Since you are working in an Enterprise Geodatabase Environment it is hard to tell why this is locked. It lockes when trying to create the fields - even if this is a process that accepts existing fields. I can make another modification - and remove the ATTEMPT to create the fields as they are never actually need to be added - I've updated the attachement above. I left the warning for existing fields in there but added a counter-message that tells you how many records are updated. Keep in mind: I only check for the LAT field being NULL ... if so - record is updated .... I renamed the UI-selection to be POINT_LAT_LONG only to reflect more what you do ... hope it works for you - then you owe me a beer 🙂 and some points here 🙂

SeanSummers_CC
Regular Contributor

That is some impressive script wizardry!  It worked and did what I needed.  Thank you so much!  I appreciate you taking the time to help me out.

0 Kudos
GünterDörffel
Frequent Contributor

Glad I could help. Never doubt ArcGIS can do it 🙂

0 Kudos
MandiraPhuyal
Emerging Contributor

Hi Gunter Dorffel:

I have a same problem that is mentioned in here, I need to calculate and update the existing X, Y, Z fields in the .sde layers but I don't want to add additional fields. Would you mind to send me your working script please if you have available. The one you shared here does not work any more. I would heartily appreciate your support. Thank you so much. 

0 Kudos