Refresh map to reflect changes to layer

1555
9
Jump to solution
02-07-2018 09:52 AM
Highlighted
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.

Reply
0 Kudos
1 Solution

Accepted Solutions
Highlighted
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
Highlighted
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

Highlighted
by
Occasional Contributor II

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.

Reply
0 Kudos
Highlighted
Esri Regular Contributor

It's planned for 2.2, shipping summer 2018.

Reply
0 Kudos
Highlighted
by
Occasional Contributor II

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

Reply
0 Kudos
Highlighted
Esri Regular Contributor

Unfortunately, there's no workaround at this time.

Reply
0 Kudos
Highlighted
Esri Regular Contributor

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

Reply
0 Kudos
Highlighted
New Contributor III

Its there now!

Highlighted
New Contributor

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!

Reply
0 Kudos
Highlighted
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

Reply
0 Kudos