ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • My Profile
  • Help
  • Sign Out
ArcGIS Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS Desktop

A complete professional GIS

ArcGIS Enterprise

GIS in your enterprise

ArcGIS Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • Documentation
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

ArcMap

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • Extensions

RefreshActiveView

  • Summary
  • Discussion
  • Syntax
  • Code sample

Summary

Refreshes the active view and table of contents of the current map document.

Discussion

RefreshActiveView is only needed if you want to see the active view of the current map document updated. arcpy.mapping export, save, and printing functions will generate the expected updated results without use of RefreshActiveView.

Syntax

RefreshActiveView ()

Code sample

RefreshActiveView example

Refresh the current map to reflect zoomToSelectedFeatures.

import arcpy

mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]
lyr = arcpy.mapping.ListLayers(mxd, "Cities", df)[0]

# Use the SelectLayerByAttribute tool to select New York and 
#  zoom to the selection
arcpy.SelectLayerByAttribute_management(lyr, "NEW_SELECTION", 
                                        "CITY_NAME = 'New York'")
df.zoomToSelectedFeatures()

# Export the map to a .jpg
arcpy.mapping.ExportToJPEG(mxd, "C:/data/NewYork.jpg")

# Clear the selection and refresh the active view
arcpy.SelectLayerByAttribute_management(lyr, "CLEAR_SELECTION")
arcpy.RefreshActiveView()

del mxd

Related topics

  • RefreshCatalog

ArcGIS Desktop

  • Home
  • Documentation
  • Support

ArcGIS

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS
  • ArcGIS Developer
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Esri Blog
  • User Conference
  • Developer Summit
Esri
Tell us what you think.
Copyright © 2021 Esri. | Privacy | Legal