Arcpy Describe Function

1293
4
Jump to solution
03-29-2018 06:48 PM
RobertStevens
Occasional Contributor III

Why does this function not recognize a project (.aprx) file?

It simply returns that the file is a ....drumroll.....File!

You may say, well, all projects have a .aprx suffix.

Well, map files, afaik, always have a .mxd suffix,

but Describe() has no difficulty in telling you it is a map.

I find this Arcpy API cumbersome and illogical The

omission I allude to here is just one example.

There is no arpy functionality to determine whether

a dataset has a join. There is no API to change a

a field's alias... And so it goes on.

And , while I am on the subject, the documentation has

this really annoying GUI that is slow and is constantly flashing

and redrawing the side bar. It is tiresome, one loses one's

place, and it probably gives people headaches (literal ones).

0 Kudos
1 Solution

Accepted Solutions
XanderBakker
Esri Esteemed Contributor

Look at the connectionProperties of a layer and you will be able to see if there are relates or joins. Just scroll down to almost the end of Updating and fixing data sources—ArcPy | ArcGIS Desktop . See the example below of what you will get as a dictionary:

{'cardinality': 'one_to_many',
 'destination': {'connection_info': {'database': 'C:\\Projects\\FGDB.gdb'},
                 'dataset': 'tabular_eco',
                 'workspace_factory': 'File Geodatabase'},
 'foreign_key': 'ECO_CODE',
 'join_forward': False,
 'join_type': 'left_outer_join',
 'primary_key': 'CODE',
 'source': {'connection_info': {'database': 'C:\\Projects\\FGDB.gdb'},
            'dataset': 'mex_eco',
            'workspace_factory': 'File Geodatabase'}}

View solution in original post

0 Kudos
4 Replies
DanPatterson_Retired
MVP Emeritus

It is the sometimes parallel access to information that might be bothering you

Many data types include properties from other property groups.

I just prefer going by the object or property, then searching here...

http://pro.arcgis.com/en/pro-app/arcpy/functions/alphabetical-list-of-arcpy-functions.htm

or here

http://pro.arcgis.com/en/pro-app/arcpy/classes/alphabetical-list-of-arcpy-classes.htm

Then each module listed here

http://pro.arcgis.com/en/pro-app/arcpy/main/arcgis-pro-arcpy-reference.htm

has their own list of functions and classes.

There are only a couple of 100 things you need to keep straight

EDIT

Noticed tha tXander threw in the API aptly and confusingly named ArcGIS which shares many common elements...

then there is

https://esri.github.io/arcgis-python-api/apidoc/html/genindex.html

And if you only know that it starts with 'arcgis' then you should be good

https://esri.github.io/arcgis-python-api/apidoc/html/py-modindex.html

XanderBakker
Esri Esteemed Contributor

Look at the connectionProperties of a layer and you will be able to see if there are relates or joins. Just scroll down to almost the end of Updating and fixing data sources—ArcPy | ArcGIS Desktop . See the example below of what you will get as a dictionary:

{'cardinality': 'one_to_many',
 'destination': {'connection_info': {'database': 'C:\\Projects\\FGDB.gdb'},
                 'dataset': 'tabular_eco',
                 'workspace_factory': 'File Geodatabase'},
 'foreign_key': 'ECO_CODE',
 'join_forward': False,
 'join_type': 'left_outer_join',
 'primary_key': 'CODE',
 'source': {'connection_info': {'database': 'C:\\Projects\\FGDB.gdb'},
            'dataset': 'mex_eco',
            'workspace_factory': 'File Geodatabase'}}
0 Kudos
RobertStevens
Occasional Contributor III

Fantastic! Thank you Xander. It's a pity this didn't exists for Arcmap. But it seems very comprehensive and will help quite a bit.

RobertStevens
Occasional Contributor III

Thank you Dan

Those urls describe what appears to be a very rich python API -- far richer than the ESRI description of ArcPy. There are many, many classes. Is that a third party API on githib (or similar)? Perhaps I have not dug deep enought into ESRI documenatation.

0 Kudos