Is there a way to obtain record set for dynamic legend?

1438
2
01-27-2014 11:03 AM
by Anonymous User
Not applicable
Original User: maplogic

As of ArcGIS destop 10.1 there is a legend option to "only show classes that are visible in the current map extent".  This allows the legend on the layout to only show symbols for features that are currently visible.

My question is whether or not there is a way to obtain the record set of features that the legend considers visible on the current map extent?  In other words, I want to know when the legend shows the symbols that are currently visible and the feature count for each symbol, which records (rows) in the layer's attribute table it is using.

I have been poking around ArcObjects trying to figure out the which object controls the "only show classes that are visible in the current map extent" property but there seems to be very little documentation of this.

I was hoping one of the Esri guru's might be able to shed some light on this.

Thanks,

Babak
0 Kudos
2 Replies
by Anonymous User
Not applicable
Original User: solxenos

You could do this by selecting features in visible extent by using map extents and performing a spatial selection, then running a cursor on selected features.  There must be some samples out there showing how to do this.  Are you asking for a an example of this?

I'm not sure if it's the same way the new Legend functionality works, but then it would depend on features visible in the layout, not in the map extent...  Do you want an example of how to select features visible in the current layout instead?
0 Kudos
by Anonymous User
Not applicable
Original User: maplogic

Sol,

Thanks for your response.  Yes, I am aware I could recreate the process manually by creating a selection set from a query using the rectangle of the current extent.  In fact I have written some code that does that for a different purpose.

However, I am trying to create a process that is time efficient.  And to create a new query on the layer every time the map is panned/zoomed/etc. is first of all much slower than whatever process Esri has baked into the legend, and is also duplicating what the legend has already done.  That's why I'd like to see if I can just get the record set from the legend.

To explain a little more as to why I want this, we have an extension that updates a legend's text labels based on information in its attribute table.  For example, you may want to have the sum of the acreage of each legend symbol to show up in the legend. I want to make this extension responsive to the dynamic legend without adding too much overhead to the map refresh.

Thanks,

Babak
0 Kudos