Select to view content in your preferred language

Get Map Layername from geometry in Sketch using C# .Net

996
3
Jump to solution
02-22-2023 01:26 AM
Zoltan_Szecsei
Occasional Contributor

Hi,

I am a total newbie at ArcGIS Pro SDK . (and C#, ESRI [pretty much])

(How) Is it possible to get the layername that the geometry in the Sketch buffer belongs to?

I have a fileGDB with 21 layers and for every (any) geometry that the user edits or adds (as a new geometry item), I want to auto update a specific Attribute Field for that Geometry item.

Thanks in advance,

Zoltan

0 Kudos
2 Solutions

Accepted Solutions
CharlesMacleod
Esri Regular Contributor

>Is it possible to get the layername that the geometry in the Sketch buffer belongs to?

no.

note - layers, as a term, relates to the content of the map (and are shown in the map table of contents). feature classes (or, somewhat, more generically, feature datasets) relates to the content in a GDB. A (feature) layer contains a feature class, sometimes called its "data source".

A _feature_, which is a row containing a geometry within a feature class, is "the" link u want to go from a geometry to a feature class (in your GDB). Typically, features are retrieved through selections (i.e. whatever it is that is _selected_ on the map - and will be highlighted in blue).

View solution in original post

Zoltan_Szecsei
Occasional Contributor

OK - Methinks I've found a better way thanks to:

https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-sdk-2-9-x-order-rowchangedevent/m-...

I'll just lookout for RowChangedEvent and RowCreatedEvent (on all 21 FCs in these GDBs)

Apologies for taking up bandwidth here, but hopefully some lurkers have benefitted from this thread.

Regards,

Zoltan

 

View solution in original post

0 Kudos
3 Replies
CharlesMacleod
Esri Regular Contributor

>Is it possible to get the layername that the geometry in the Sketch buffer belongs to?

no.

note - layers, as a term, relates to the content of the map (and are shown in the map table of contents). feature classes (or, somewhat, more generically, feature datasets) relates to the content in a GDB. A (feature) layer contains a feature class, sometimes called its "data source".

A _feature_, which is a row containing a geometry within a feature class, is "the" link u want to go from a geometry to a feature class (in your GDB). Typically, features are retrieved through selections (i.e. whatever it is that is _selected_ on the map - and will be highlighted in blue).

Zoltan_Szecsei
Occasional Contributor

Hi Charles,

Thanks for the simplified "No" response (which blocks further discussion on this trajectory) and for the "selected features" pointer.

Just to confirm:

I selected  bunch of features across various datasets (feature classes) and then went to the 'modify features' panel to find that the only way to edit any of these features is to double-click one - and then only the 'Edit Vertices' becomes available. This single feature is then loaded into the Sketch buffer and vertex editing can begin (thereby also wrecking the original Selected Set).

BUT

What if the user miss-clicks a vertex during edits and/or selects a new geometry (by design or by mistake)?

The sketch buffer is then loaded with the newly selected item.

So the problem now is at what point do I check the Selected Geometry buffer, so that I can update the correct ROW attribute field?

Is it safe to check selected set after each (if any) OnSketchCanceledAsync() event?

Then what if the user decides to undo an edit? Is any OnSketchModifiedAsync() event somehow cancelled if the user exists editing after undoing their edits? - In this case, updating the "DateLastUpdated" attribute field would NOT be warranted.

Perhaps the rigid way to do this would be a counter to increment after each sketch modified event and decrement after each 'undo' event (if that is possible)?

Yes, OnSketchCompletedAsync needs be tracked - but the edit/undo-edit sequence is still relevant.

Seems like I am over-thinking this, so further insights from anyone would be great.

It seems a pity that the Select Set is compromised when editing geometry.

 

Regards,

Zoltan

0 Kudos
Zoltan_Szecsei
Occasional Contributor

OK - Methinks I've found a better way thanks to:

https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-sdk-2-9-x-order-rowchangedevent/m-...

I'll just lookout for RowChangedEvent and RowCreatedEvent (on all 21 FCs in these GDBs)

Apologies for taking up bandwidth here, but hopefully some lurkers have benefitted from this thread.

Regards,

Zoltan

 

0 Kudos