Title Update Data Sources
Use this tool to convert the data source of layers in the maps in the current ArcGIS Pro project to a workspace.
This tool changes the data source of the maps to a new workspace. This will convert between file geodatabase, enterprise geodatabase, and feature services.
When changing from or to a feature service, the layer alias name in the service (with or without spaces) must match the class name alias.
License
BasicToolset
Map
AdjustDataSources (target_workspace, maps, {update_sr}, {match_layer_id})
Parameter | Explanation | Data Type |
---|---|---|
target_workspace |
Dialog Reference
The new workspace for the layers. |
DEWorkspace |
maps |
Dialog Reference
The maps in the current ArcGIS Pro project to update the data source in. |
GPMap |
update_sr (Optional) |
Dialog Reference
Use the spatial reference from the first feature class to update the maps spatial reference. The error layers are ignored as they are always in 102100. |
GPBoolean |
match_layer_id (Optional) |
Dialog Reference
Option to match using the Layer ID of the source and target when the names and/or aliases cannot be matched. |
GPBoolean |
AdjustDataSources example 1 (Python window)
Change the workspace in the active map to a local geodatabase.
import arcpy
arcpy.udms.AdjustDataSources("D:/data/network.gdb/UtilityNetwork/Network", ["Network Editor"])
AdjustDataSources example 2 (stand-alone script)
Change the workspace in all maps to a feature service.
import arcpy
url = "https://acme.com/server/rest/services/MyUtilityNetwork/FeatureServer"
# List all maps in the active Pro project.
maps = arcpy.mp.ArcGISProject("current").listMaps("*")
arcpy.udms.AdjustDataSources(
target_workspace=url,
maps=[m.name for m in maps],
update_sr=False,
)