Select to view content in your preferred language

Calculate Geometry Attributes with geographic coordinates

830
6
Jump to solution
08-07-2023 10:32 AM
Craig_Eissler_Iceman
Occasional Contributor III

When your data is in 'geographic coordinates', the Calculate Geometry tool -- accessed from the Attribute Table -- is grayed-out. ...I thought I've always understood why, but maybe not..?

Because, if I access the Calculate Geometry Attributes tool from ArcToolbox, this restriction is NOT there.
In fact, I can even calculate the geometry (...say, Area  in Acres or Square Miles) using Planar or Geodesic modes and a geographic coordinate system as the basis for that calculation.

Can someone explain this nuance?

1 Solution

Accepted Solutions
Craig_Eissler_Iceman
Occasional Contributor III

Umm, I'm not sure about that. Whether I have that box checked or not doesn't seem to change anything.

For as long as I can remember, the Calculate Geometry has always been grayed-out (and is supposed to be) if your Shape_geometry fields (i.e. Shape_length, Shape_Area) are in 'geographic coordinates'. ...SO, I'm totally OK with that. 

What I'm confused about is when I access the Calculate Geometry tool from ArcToolbox, this is NOT the same behavior. ...So, I'm wondering "why not"?

View solution in original post

0 Kudos
6 Replies
DanPatterson
MVP Esteemed Contributor

You can examine the various logic implementations from the script associated with the tool depending on the active document.  For instance beginning in line 90 in

               # Remove Euclidean measurements if the data is GCS/Mercator
                if gcsOrMercator and not self.params[4].value:
                    for propGCS in ["LENGTH", "AREA", "PERIMETER_LENGTH"]:
                        try:
                            propList.remove(propGCS)
                        except:
                            pass
                # Remove Geodesic options if the data SR is Unknown
                if sr.name.upper() == "UNKNOWN":
                    for propUk in ["LENGTH_GEODESIC", "AREA_GEODESIC",
                                   "PERIMETER_LENGTH_GEODESIC"]:
                        try:
                            propList.remove(propUk)
                        except:
                            pass
                self.params[1].filters[1].list = propList
            except:

 the tool validator script certain calculation options are removed when the coordinate system is geographic, unknown etc.

See the script located in  "C:\...Install path...\Resources\ArcToolBox\toolboxes\Data Management Tools.tbx\CalculateGeometryAttributes.tool\tool.script.validate.py" for more examples.  The script is located in ..\..\..\scripts\calculategeometry.py path.

When the tool is associated with a script, it is useful to examine the implementation and its restrictions.

 


... sort of retired...
0 Kudos
Craig_Eissler_Iceman
Occasional Contributor III

Thanks, but I guess my question is "why" is there a difference with the same tool depending on how you access it? In other words, is there something to really understand here, or did the Developers decide to have 2 versions because they felt like it?

 

0 Kudos
BarryNorthey
Occasional Contributor III

If by chance you have this Application option enabled (the default is not enabled):

BarryNorthey_0-1691468272269.pngyou have to enable editing using the Edit button

BarryNorthey_2-1691468426123.png

under the Edit core tab.

 

 

0 Kudos
Craig_Eissler_Iceman
Occasional Contributor III

Hello, but not sure what you're taking about.

My question was "why" is there a difference in the two Calculate Geometry versions -- with respect to working with geographic coordinates?

0 Kudos
BarryNorthey
Occasional Contributor III

I was addressing the tool "grayed out" situation. If the editing tools are disabled, the Calculate Geometry tool will be grayed out. The default is for editing tools to be enabled and the Edit  button is hidden but I have exposed the Edit button and sometimes forget to enable them prior to editing, which happened when I first tried a test. I also saw that if a table had a join it could be the problem.

BarryNorthey_0-1691515104516.png

When I enable the editing tools Calculate Geometry functions the same for me from the table as from the toolbox even on geographic data. So just pointing out a possible source of the problem.

0 Kudos
Craig_Eissler_Iceman
Occasional Contributor III

Umm, I'm not sure about that. Whether I have that box checked or not doesn't seem to change anything.

For as long as I can remember, the Calculate Geometry has always been grayed-out (and is supposed to be) if your Shape_geometry fields (i.e. Shape_length, Shape_Area) are in 'geographic coordinates'. ...SO, I'm totally OK with that. 

What I'm confused about is when I access the Calculate Geometry tool from ArcToolbox, this is NOT the same behavior. ...So, I'm wondering "why not"?

0 Kudos