Can you access feature layers without a map? If not, can you delete a map from a project or create a temporary map?

1265
6
08-02-2019 01:55 PM
ufshall
New Contributor II

I need to access the attributes from various feature classes and, to the best of my knowledge, you can only do this through a feature layer loaded into a map. I am currently trying to create a map object, run the needed processes, then delete that map object. Is there a way to do this "behind the scenes" or without having an active map? I cannot find anything on being able to delete that map object.

0 Kudos
6 Replies
ThomasEmge
Esri Contributor

Scott,

you don't necessarily have to load the feature class into a map. Take a look at this code snippet if you just want to interact with the feature class and don't need to render it.

https://github.com/esri/arcgis-pro-sdk/wiki/ProSnippets-Geodatabase#opening-datasets-from-geodatabas...

- Thomas

0 Kudos
ufshall
New Contributor II

But to access the attributes of a feature class you have to use that class as a feature layer in a map and that feature layer is then loaded into an Inspector. Can you use a feature layer without a map? Or be able to delete a map after it is used as an object purely to load a feature layer.

0 Kudos
ModyBuchbinder
Esri Regular Contributor

Hi Scott

You can query, search and get all values from FeatureClass, no need to make a FeatureLayer.

here is one example: https://github.com/esri/arcgis-pro-sdk/wiki/ProSnippets-Geodatabase#searching-a-featureclass-using-s... but there are many more in the same page

Have Fun

0 Kudos
ufshall
New Contributor II

That method does not allow you to get to the attribute data associated with the feature. According to the SDK, that can only be done through an Inspector() loaded with a feature layer, ProConcepts Editing · Esri/arcgis-pro-sdk Wiki · GitHub 

0 Kudos
RichRuh
Esri Regular Contributor

Hi Scott,

Once you fetch an individual feature, you can certainly view and edit the attribute data.  Here is an example showing how to modify a row: ProSnippets Geodatabase · Esri/arcgis-pro-sdk Wiki · GitHub 

I hope this helps,

--Rich

0 Kudos
MichaelSnook
Occasional Contributor III

Hi...did you ever find a solution to this? 

I'm finding the same odd issue that isn't quite understood when trying to explain. I have an old .lyr file that was saved from a SQL server query (Query Layer).  I have since converted that to a lyrx file and I just want to use that lyrx file to search through the data...without adding it to a map.  In ArcObjects it was simple to get a FeatureLayer loaded from a lyr file.  Not only that, any set definition queries came along with it so you didn't have to wire that part up when searching the 'raw' feature class underlying the FeatureLayer.

Any ideas would be great!

Thanks

0 Kudos