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

7068
14
Jump to solution
04-17-2017 08:41 AM
AileenProfir
New Contributor III

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
1 Solution

Accepted Solutions
GünterDörffel
Occasional Contributor III

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 🙂

View solution in original post

14 Replies
DanPatterson_Retired
MVP Emeritus

apparently that isn't used for getting the coordinates of points in a GSC according to other reports... for example...

Robert_LeClair
Esri Notable Contributor

In ArcGIS Pro, you could use the Add XY Coordinates GP tool to create 2 new attribute fields.  If your data is in another coordinate system, go the Environment Settings of the GP tool and set the Coordinate System to be WGS 1984.  By doing this, the PointX and PointY attribute fields will calculate Decimal-Degrees.

SeanSummers_CC
New Contributor III

I'm not sure how this would work for me. Perhaps you might have a better idea?  I have an existing building points feature class (it's in State Plane feet) and it already has an existing LAT and LONG field.  If a new building is constructed I add a new point and I need to calculate the LAT and LONG. In desktop I would just open the attribute table and "Calculate Geometry" and choose Decimal Degrees.  Is there no way to do something similar in PRO? It appears the "Add XY Coordinates" tool would calculate the fields for the entire feature class? Am I missing something simple and stupid or do I really have to go through a long convoluted process to do this?  Any suggestions would be greatly appreciated.

0 Kudos
Robert_LeClair
Esri Notable Contributor

Sean - you could use the Add Geometry Attributes GP tool on the selected records and obtain the Point x, y, z and m coordinates.  In the GP parameters, set the Coordinate System to WGS1984 to obtain the lat/long fields.  Hope this helps!

SeanSummers_CC
New Contributor III

You are correct that I can run the tool on a selected point and get the coordinates I want. The problem I am having is that this tool creates its own fields to store the coordinates. I can not add fields to my point feature class.  It is in an SDE environment and my organization has all of the fields already set up and I do not have permissions to add further fields. As I stated above, I know that I could create my own temporary point fc just to calculate these coordinates and then copy and paste them in, but I was hoping for a simpler solution like the old "Calculate Geometry".  I added my question to this string because I too was trying to use the !SHAPE.centroid.X@decimaldegrees! with the Field Calculator thinking I had found a work around.   I appreciate any ideas and thank you for your time.

0 Kudos
Robert_LeClair
Esri Notable Contributor

Understand where you're coming from Sean.  There is a "Calculate Geometry in ArcGIS Pro" idea that you can vote on currently.  Not the ideal solution certainly but a way to get this on the radar for the Pro Dev Team.

JakeKrall
Occasional Contributor III

Robert,

Please just add the tool back in!  Why should we have to vote on it to see if we need it or not?  Thank you for your concern.

0 Kudos
Robert_LeClair
Esri Notable Contributor

As an Esri Instructor, I wish I had that power.  The Pro forums are actively monitored by the Pro Dev Team so I'm sure they're aware this functionality needs to be added for our customers.  The ArcGIS Ideas page is another way to move priority requests faster based upon voting.  The next release of Pro, 2.1, is scheduled for Q4 2017 so I'm hopeful it's there.  I know my students use this function in ArcMap regularly.

0 Kudos
GünterDörffel
Occasional Contributor III

Hi all,

In Pro as in Map there is a script based tool called "Add Geometry ...". The script is pretty elaborate but with a few minor changes and "reductions" it should do what you want. Find attached a toolbox with a modified sript ingested in it that (from analyzing the text above) does pretty much what you want:

  • On a 2D FeatureClass it adds (or updates) LAT and LONG fields and writes geographic coordinates into the fields. If the fields are already present, a warning will show but the tool will run
  • A selection on the LAT field has been added: If the field is not NULL, the calculation will not be done for that record - this should make sure existing fields are not overwritten
  • As a default WGS 84 are set
  • No questions asked for Units - since "nulled" the tool will write x and y in decimal degree

What I didnt do: 

  • Cover all the rest of if/whens: Z,M, Other field namings, ...
  • Took care of projections/transformations

Give it a try or export the script from the toolbox and modify. All modifications to the original esri version I made can be found in the python code by searching for comments starting with  #GD:

Regards
Guenter