Refresh map to reflect changes to layer

4364
9
Jump to solution
02-07-2018 09:52 AM
DanielRouleau
New Contributor III

I'm looking for something similar to IActiveView.Refresh from the ArcObjects world. My use case is that I'm running a tool that updates the features in the layer, and I need a way to get the map to re-draw from my code similar to how the out-of-the-box tools are doing automatically.

In my particular example, I am using UNME and am validating the Utility Network topology, which causes the Dirty Areas polygon layer to remove polygons for areas that are valid. I tried looking around for a way to invalidate just that layer but wasn't having much luck. Any clues for how to get the layer to refresh properly? This layer is coming from a feature service published through ArcGIS Enterprise per requirements of the UNME.

0 Kudos
1 Solution

Accepted Solutions
RichRuh
Esri Regular Contributor

Daniel,

In Pro 2.2, we'll be adding a method to the MapView class called Redraw().  This method will take a boolean parameter named clearCache.  If set to true, this will reset any current features caches on layers in the view.  This should solve your problem.

As a work-around at 2.1, you can call the Validate Network Topology geoprocessing tool via the Geoprocessing API, as shown here.  This will correctly redraw the map.

--Rich

View solution in original post

9 Replies
RichRuh
Esri Regular Contributor

Daniel,

In Pro 2.2, we'll be adding a method to the MapView class called Redraw().  This method will take a boolean parameter named clearCache.  If set to true, this will reset any current features caches on layers in the view.  This should solve your problem.

As a work-around at 2.1, you can call the Validate Network Topology geoprocessing tool via the Geoprocessing API, as shown here.  This will correctly redraw the map.

--Rich

MKa
by
Occasional Contributor III

Did this Redraw Class ever get created?  I need to redraw my feature class as I have multiple users working in the same geographic area and being able to trigger this would be great.

0 Kudos
RichRuh
Esri Regular Contributor

It's planned for 2.2, shipping summer 2018.

0 Kudos
MKa
by
Occasional Contributor III

What is a workaround to refresh the feature cache for a particular layer?  Is there something I am not finding here?

0 Kudos
RichRuh
Esri Regular Contributor

Unfortunately, there's no workaround at this time.

0 Kudos
RichRuh
Esri Regular Contributor

Just to confirm, this method will be available in Pro 2.2.

0 Kudos
EricO_Neal1
New Contributor III

Its there now!

CharlesSummerhill
New Contributor II

I'm interesting in using this new method, but can't find any documentation or examples. My attempts to make a call to it fail, but wanted to follow-up to see if anyone had anything to share.

Thanks!

0 Kudos
RichRuh
Esri Regular Contributor

Charles,

The API reference is here: http://prodev.arcgis.com/en/pro-app/sdk/api-reference/#topic20822.html 

Can you share more about what isn't working?

Thanks,

--Rich

0 Kudos