Help with creating feature in Python, then having the feature show in both the Catalog (works) and the Table of Contents (does not work).

557
1
Jump to solution
07-11-2018 01:05 PM
CharlesSummerhill
New Contributor II

Using Python to create a number of features (specifically using Copy Feature on a newly created set of joined tables) that will be available in both the Catalog and the Table of Contents.

  • Using ArcGIS Pro 2.2.
  • All of the Python is run external to ArcGIS Pro.
  • The Copy Feature works and creates the feature in the Catalog. When opening the map in ArcGIS Pro the item is in the Catalog, but is not available in the Table of Contents.

Basically asking if there is a Python command / geoprocessing tool that will make a feature that exists in the Catalog also available in the Table of Contents without having to manually add it to the map.

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
JoshuaBixby
MVP Esteemed Contributor

The Copy Feature works and creates the feature in the Catalog.

When using Copy Features, nothing "creates the feature in the Catalog."   The output of Copy Features is created in a folder or geodatabase somewhere.  If the folder or geodatabase location has been added to an ArcGIS Pro project, you can see the new data in Catalog, but this is Pro viewing data that exists and not having something created for it.

If you want to add newly created data sets to a Pro project, you can use the following code to start experimenting:

import arcpy

aprx_path = # path to ArcGIS Pro project file
data_path = # path to newly created data set to add to a map in Pro

aprx = arcpy.mp.ArcGISProject(aprx_path)
map = aprx.listMaps()[0]  # this assume you want data added to first map
map.addDataFromPath(data_path)
aprx.save()

View solution in original post

1 Reply
JoshuaBixby
MVP Esteemed Contributor

The Copy Feature works and creates the feature in the Catalog.

When using Copy Features, nothing "creates the feature in the Catalog."   The output of Copy Features is created in a folder or geodatabase somewhere.  If the folder or geodatabase location has been added to an ArcGIS Pro project, you can see the new data in Catalog, but this is Pro viewing data that exists and not having something created for it.

If you want to add newly created data sets to a Pro project, you can use the following code to start experimenting:

import arcpy

aprx_path = # path to ArcGIS Pro project file
data_path = # path to newly created data set to add to a map in Pro

aprx = arcpy.mp.ArcGISProject(aprx_path)
map = aprx.listMaps()[0]  # this assume you want data added to first map
map.addDataFromPath(data_path)
aprx.save()