when this runs I don't get any errors. When I open the mxd it changed the workspace to the correct SDE but the raster's dataset_name is still the old name ("STATIC.DATALOADER.AP2008") rather than the one I provided.
Anyone have any ideas? I'm running arcgis 10sp2 thanks, -chris
In the original post, the posting person was trying to convert rasters from one SDE database to another. In your response, you said it would be better to use a mosaic dataset to store the raster data. As such, I would want to convert raster data from SDE to a mosaic dataset for layers that I have saved in many mxds. I thought you were indicating that this can be done, but your last post said this is not possible with replaceDataSource.
Is there any other python method that could be used to make this conversion? Your feedback is greatly appreciated. Thanks.
In the previous post the user ran into an issue when attempting to update an SDE Raster Dataset in an MXD with another SDE Raster Dataset. I recommended to use Mosaic Datasets rather than SDE Raster Datasets for better data management and performance.
At the moment, updating the MXDs with Mosaic Datasets would be best accomplished manually. You could create a layer file of the mosaic dataset and then add the layer file using the 'addlayer' method, but you don't have many placement options when adding the layer file.
Do you know if it will be a capability of python scripting in ArcGIS v10.1 to convert SDE raster images to a mosaic dataset? I would need to perform this task on 10s of thousands of layers so a manual approach is extremely impractical. Thanks.
I cannot say for sure if this will be available in 10.1. Your best bet would to be to remove the raster layers in the MXDs by iterating through each layer in each MXD, and then adding a layer file of the mosaic dataset to the MXD. I am assuming that the raster imagery is used as background data, so specifying "BOTTOM" for the position with the 'addlayer' method should work in most cases.
Besides a Mosaic Dataset, what do you think would be the best way to store raster images outside of SDE to get excellent performance in ArcMap, where I would be able to use the replaceDataSource in python to get an automated solution that can be performed during non-business hours?
In response to your last post, many of the the current SDE image layers can be found in group layers and not necessarily at the bottom of the TOC, so your approach would by no means be the universal solution for my organization. In the past I had resourced these same images from IMS to SDE using a programmatic approach in VBA, but group layers also presented a problem. I had to resource these layers manually after getting an inventory of how often this occurred on my network. I was hoping the replaceDataSource in python for ArcMap v10.0 would make this task easier, but it appears that this option was not accounted for at this point in python.
To address the issue of replacing an SDE raster image with a raster mosaic, have you tried arcpy.mapping.UpdateLayer with symbology_only=False? Author a layer file pointing to your raster mosaic and then find and update your SDE raster images found within your MXDs. UpdateLayer has the ability to completely swap our entire layers (including data type).
The UpdateLayer method with the False parameter for symbology appears to do exactly what I need. Preliminary testing worked perfectly and now I need to test with more complex mxds where there are multiple dataframes and layers in a Group Layer that need to be replaced.