<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: replaceDataSource not working in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/replacedatasource-not-working/m-p/181336#M13942</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Jake:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In the original post, the posting person was trying to convert rasters from one SDE database to another.&amp;nbsp; In your response, you said it would be better to use a mosaic dataset to store the raster data.&amp;nbsp; As such, I would want to convert raster data from SDE to a mosaic dataset for layers that I have saved in many mxds.&amp;nbsp; I thought you were indicating that this can be done, but your last post said this is not possible with replaceDataSource.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there any other python method that could be used to make this conversion?&amp;nbsp; Your feedback is greatly appreciated.&amp;nbsp; Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 13 Feb 2012 16:24:39 GMT</pubDate>
    <dc:creator>MichaelVolz</dc:creator>
    <dc:date>2012-02-13T16:24:39Z</dc:date>
    <item>
      <title>replaceDataSource not working</title>
      <link>https://community.esri.com/t5/python-questions/replacedatasource-not-working/m-p/181326#M13932</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm trying to redirect a raster layer in an mxd from one SDE to another.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;the relavent Code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;sdeFile = r"G:\DEPARTMENTS\GIS\Chris_Graff\temp\Aerial.sde"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;lyr.replaceDataSource(sdeFile, "SDE_WORKSPACE", r"AERIAL.DATALOADER.AP2008", True)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;when this runs I don't get any errors.&amp;nbsp; 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.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Anyone have any ideas?&amp;nbsp; I'm running arcgis 10sp2&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-chris&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jul 2011 15:50:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/replacedatasource-not-working/m-p/181326#M13932</guid>
      <dc:creator>ChristopherGraff</dc:creator>
      <dc:date>2011-07-20T15:50:24Z</dc:date>
    </item>
    <item>
      <title>Re: replaceDataSource not working</title>
      <link>https://community.esri.com/t5/python-questions/replacedatasource-not-working/m-p/181327#M13933</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If helpful here's the full code....&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import os, arcpy
start = r"G:\DEPARTMENTS\GIS\Chris_Graff\temp\scketchup"
sdeFile = r"G:\DEPARTMENTS\GIS\Chris_Graff\temp\Aerial.sde"

for root, dirs, files in os.walk(start):
&amp;nbsp;&amp;nbsp;&amp;nbsp; for file in files:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if file.endswith(".mxd"):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; path = os.path.abspath(os.path.join(root,file))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd = arcpy.mapping.MapDocument(path)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print path
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for lyr in arcpy.mapping.ListLayers(mxd):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if lyr.supports("SERVICEPROPERTIES") and lyr.serviceProperties["ServiceType"] == "SDE":
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if lyr.datasetName.upper() == "STATIC.DATALOADER.AP2008":
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "!&amp;nbsp;&amp;nbsp; " + lyr.datasetName
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lyr.replaceDataSource(sdeFile, "SDE_WORKSPACE", r"AERIAL.DATALOADER.AP2008", True)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "NEW " + lyr.datasetName
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if lyr.isRasterLayer:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "!!!!" + lyr.datasetName
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "&amp;nbsp;&amp;nbsp;&amp;nbsp; " + lyr.datasetName
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "&amp;nbsp;&amp;nbsp;&amp;nbsp; " + lyr.name
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd.save()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; except IOError as e:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Save failed!"

del mxd, lyr, file, path
 &lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:16:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/replacedatasource-not-working/m-p/181327#M13933</guid>
      <dc:creator>ChristopherGraff</dc:creator>
      <dc:date>2021-12-11T09:16:06Z</dc:date>
    </item>
    <item>
      <title>Re: replaceDataSource not working</title>
      <link>https://community.esri.com/t5/python-questions/replacedatasource-not-working/m-p/181328#M13934</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You can update the layer name by searching for a keyword and then replacing the text.&amp;nbsp; I was working on a similar script earlier this morning.&amp;nbsp; I added this functionality to it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy, os
from arcpy import env
from arcpy import mapping
env.workspace = workspace = arcpy.GetParameterAsText(0)

env.overwriteOutput = True

for (path, dirs, files) in os.walk(workspace):
&amp;nbsp;&amp;nbsp;&amp;nbsp; for file in files:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ".mxd" in file.lower():
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd = os.path.join(path, file)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print mxd + " is being processed"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd = mapping.MapDocument(mxd)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for df in mapping.ListDataFrames(mxd, "*"):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for lyr in mapping.ListLayers(mxd, "*", df):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lyr.replaceDataSource(arcpy.GetParameterAsText(1), "SDE_WORKSPACE", "")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Successfully updated data sources"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if "vector" in lyr.name:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lyr.name = "RASTER.DATALOADER." + lyr.name.split(".")[2]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Succesfully changed layer name"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd.save()

del mxd&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The previous database name was "vector", so the feature classes were listed as "vector.dataloader.parcels".&amp;nbsp; I created and IF statement to find all layer names containing vector and renamed the layers to the new database raster:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; if "vector" in lyr.name:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lyr.name = "raster.dataloader." + lyr.name.split(".")[2]&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:16:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/replacedatasource-not-working/m-p/181328#M13934</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2021-12-11T09:16:09Z</dc:date>
    </item>
    <item>
      <title>Re: replaceDataSource not working</title>
      <link>https://community.esri.com/t5/python-questions/replacedatasource-not-working/m-p/181329#M13935</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;My problem is not with the lyr.name, its the lyr.datasetName.&amp;nbsp; I need to change the datasetName as the lyr.replaceDataSource class is not honoring any string I try to use.&amp;nbsp; Whatever I use lyr.replaceDataSource always returns the original datasetName.&amp;nbsp; I've tried all the below but always the datasetName remains unchanged.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;lyr.replaceDataSource(sdeFile, "SDE_WORKSPACE", "AERIAL.DATALOADER.AP2008", True)&lt;/PRE&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;lyr.replaceDataSource(sdeFile, "SDE_WORKSPACE", "AP2008", True)&lt;/PRE&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;lyr.replaceDataSource(sdeFile, "SDE_WORKSPACE", "", True)&lt;/PRE&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;lyr.replaceDataSource(sdeFile, "SDE_WORKSPACE", "newName", True)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Since the the datasetName contains a referance to the old database, even though the SDE data source changes, the layer in the mxd is broken.&amp;nbsp; Does lyr.replaceDataSource not honor raster datsets in SDE?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jul 2011 12:23:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/replacedatasource-not-working/m-p/181329#M13935</guid>
      <dc:creator>ChristopherGraff</dc:creator>
      <dc:date>2011-07-21T12:23:17Z</dc:date>
    </item>
    <item>
      <title>Re: replaceDataSource not working</title>
      <link>https://community.esri.com/t5/python-questions/replacedatasource-not-working/m-p/181330#M13936</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Looks like this may be a bug for the replaceDataSource method and raster datasets.&amp;nbsp; However, this works with Mosaic Datasets.&amp;nbsp; Have you considered migrating your large raster mosaics to &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//009t00000037000000"&gt;Mosaic Datasets&lt;/A&gt;&lt;SPAN&gt;?&amp;nbsp; This is a much more efficient way to manage your imagery at ArcGIS 10.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The mosaic dataset makes it easy for you to manage, search, and discover imagery in collections of any size. The mosaic dataset catalogs image and raster data sources, stores detailed metadata, and defines how imagery should be transformed into different products on the fly without the need&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;to preprocess. The mosaic dataset includes:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;�?� Dynamic mosaicking for efficient handling of overlapping imagery&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;�?� On-the-fly processing to create multiple products from a single source&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;�?� Management and accessibility to metadata&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;�?� Integration for multiple disparate image sensors and formats&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;�?� Streamlined data maintenance and updates of new imagery&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The mosaic dataset also saves time and storage space.&amp;nbsp; The mosaic dataset simply reads the images from their native file locations and format.&amp;nbsp; Since it reads the data from their native file locations it is extremely fast to create mosaic datasets.&amp;nbsp; Loading large rasters into SDE that took hours will only take seconds now and you will no longer have to allocated the storage space in your SDE database to accomodate these large rasters.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jul 2011 15:34:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/replacedatasource-not-working/m-p/181330#M13936</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2011-07-21T15:34:26Z</dc:date>
    </item>
    <item>
      <title>Re: replaceDataSource not working</title>
      <link>https://community.esri.com/t5/python-questions/replacedatasource-not-working/m-p/181331#M13937</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Do I need to submit this as a bug or have you?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Our organization only deals with new imagery every 3 years and we maintain tight controls ending up with standard projections, pixel sizes, etc, so many of the traditional uses of raster catalogs haven't really applied to us.&amp;nbsp; Having a fairly robust enterprise desktop, server and mobile users we've enjoyed the benifet of having our aerials pre-processed into SDE.&amp;nbsp; In 20years we've only now ever needed to move one.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is it still the case that I/O performace is faster from an SDE raster dataset than a catalog (particularly if the imagery is accessed through files)?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks so much for your help,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-chris&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jul 2011 17:39:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/replacedatasource-not-working/m-p/181331#M13937</guid>
      <dc:creator>ChristopherGraff</dc:creator>
      <dc:date>2011-07-21T17:39:35Z</dc:date>
    </item>
    <item>
      <title>Re: replaceDataSource not working</title>
      <link>https://community.esri.com/t5/python-questions/replacedatasource-not-working/m-p/181332#M13938</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have not submitted this as a bug.&amp;nbsp; Feel free to do so if you'd like, I'm not sure that I will have the time.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Mosaic Datasets are a hybrid of raster datasets and raster catalogs.&amp;nbsp; They render extremely fast due to the mosaic dataset's &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//009t00000040000000"&gt;overviews&lt;/A&gt;&lt;SPAN&gt;.&amp;nbsp; Mosaic Datasets render just as fast as raster datasets, plus you receive the additional benefits that the mosaic dataset has to offer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would recommend taking a look at the following &lt;/SPAN&gt;&lt;A href="http://video.esri.com/watch/22/arcgis-managing-imagery"&gt;video&lt;/A&gt;&lt;SPAN&gt; to see how great and easy to use Mosaic Datasets are.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jul 2011 18:38:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/replacedatasource-not-working/m-p/181332#M13938</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2011-07-21T18:38:15Z</dc:date>
    </item>
    <item>
      <title>Re: replaceDataSource not working</title>
      <link>https://community.esri.com/t5/python-questions/replacedatasource-not-working/m-p/181333#M13939</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I would like to add that I am experiencing this exact same problem and it is not just a raster dataset issue. It appears to fail with spatial views.&amp;nbsp; It changes everything except the Feature Class when you view the source in ArcMap. This code is successful on normal feature classes and anno.&amp;nbsp; (ArcGIS 10 sp2 build 3200)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import string&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;mxd = arcpy.mapping.MapDocument(r"E:\source_control\MXDs\Map_Services\General4.mxd")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;sdePath = r"C:\Users\damian\AppData\Roaming\ESRI\Desktop10.0\ArcCatalog\atlas_spatial.sde"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for lyr in arcpy.mapping.ListLayers(mxd):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (lyr.supports("DATASOURCE") and lyr.supports("datasetName")):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; layerName = r"ATLAS_SPATIAL."&amp;nbsp; + lyr.datasetName.split('.')[1]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lyr.replaceDataSource(sdePath,"SDE_WORKSPACE",layerName,False)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;mxd.saveACopy(r"E:\source_control\MXDs\Map_Services\General10.mxd")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;del mxd&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Jul 2011 23:41:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/replacedatasource-not-working/m-p/181333#M13939</guid>
      <dc:creator>DamianSchroder</dc:creator>
      <dc:date>2011-07-22T23:41:47Z</dc:date>
    </item>
    <item>
      <title>Re: replaceDataSource not working</title>
      <link>https://community.esri.com/t5/python-questions/replacedatasource-not-working/m-p/181334#M13940</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Jake:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What would be the replaceDataSource syntax if one was converting from a raster in SDE to a mosaic dataset in a file geodatabase?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is the syntax I am using, which follows the ArcGIS Help, but I am getting an error message:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
elif layr.datasetName == "ORTHO2005.ORTHOS2005":
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print("The dataset name in Resource_mxd is " + layr.datasetName)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; layr.replaceDataSource(r"\\gis\GIS\Work\arcmap\mosaic_2010.gdb", "FILEGDB_WORKSPACE", "orthos_2010")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In this code, "orthos_2010" is the mosaic dataset that contains 2010 Orthophotos.&amp;nbsp; I am not specifying where the data originates in SDE, other than making sure that the focus layer to be converted has a datasetName =&amp;nbsp; ORTHO2005.ORTHOS2005, as I did not need to do this for vector datasets that I resourced from SDE to a file geodatabase.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Your assistance is greatly appreciated.&amp;nbsp; Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:16:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/replacedatasource-not-working/m-p/181334#M13940</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2021-12-11T09:16:11Z</dc:date>
    </item>
    <item>
      <title>Re: replaceDataSource not working</title>
      <link>https://community.esri.com/t5/python-questions/replacedatasource-not-working/m-p/181335#M13941</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Michael,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You won't be able to change data types (i.e. Raster Dataset to Mosaic Dataset).&amp;nbsp; You can only change the data source if the data type matches (i.e. Raster Dataset to Raster Dataset or Mosaic Dataset to Mosaic Dataset).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Feb 2012 16:13:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/replacedatasource-not-working/m-p/181335#M13941</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2012-02-13T16:13:13Z</dc:date>
    </item>
    <item>
      <title>Re: replaceDataSource not working</title>
      <link>https://community.esri.com/t5/python-questions/replacedatasource-not-working/m-p/181336#M13942</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Jake:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In the original post, the posting person was trying to convert rasters from one SDE database to another.&amp;nbsp; In your response, you said it would be better to use a mosaic dataset to store the raster data.&amp;nbsp; As such, I would want to convert raster data from SDE to a mosaic dataset for layers that I have saved in many mxds.&amp;nbsp; I thought you were indicating that this can be done, but your last post said this is not possible with replaceDataSource.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there any other python method that could be used to make this conversion?&amp;nbsp; Your feedback is greatly appreciated.&amp;nbsp; Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Feb 2012 16:24:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/replacedatasource-not-working/m-p/181336#M13942</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2012-02-13T16:24:39Z</dc:date>
    </item>
    <item>
      <title>Re: replaceDataSource not working</title>
      <link>https://community.esri.com/t5/python-questions/replacedatasource-not-working/m-p/181337#M13943</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;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.&amp;nbsp; I recommended to use Mosaic Datasets rather than SDE Raster Datasets for better data management and performance.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;At the moment, updating the MXDs with Mosaic Datasets would be best accomplished manually.&amp;nbsp; 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.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Feb 2012 16:52:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/replacedatasource-not-working/m-p/181337#M13943</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2012-02-13T16:52:51Z</dc:date>
    </item>
    <item>
      <title>Re: replaceDataSource not working</title>
      <link>https://community.esri.com/t5/python-questions/replacedatasource-not-working/m-p/181338#M13944</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Jake:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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?&amp;nbsp; I would need to perform this task on 10s of thousands of layers so a manual approach is extremely impractical.&amp;nbsp; Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Feb 2012 17:11:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/replacedatasource-not-working/m-p/181338#M13944</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2012-02-13T17:11:37Z</dc:date>
    </item>
    <item>
      <title>Re: replaceDataSource not working</title>
      <link>https://community.esri.com/t5/python-questions/replacedatasource-not-working/m-p/181339#M13945</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I cannot say for sure if this will be available in 10.1.&amp;nbsp; 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.&amp;nbsp; 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.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Feb 2012 17:26:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/replacedatasource-not-working/m-p/181339#M13945</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2012-02-13T17:26:54Z</dc:date>
    </item>
    <item>
      <title>Re: replaceDataSource not working</title>
      <link>https://community.esri.com/t5/python-questions/replacedatasource-not-working/m-p/181340#M13946</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Jake:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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.&amp;nbsp; 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.&amp;nbsp; I had to resource these layers manually after getting an inventory of how often this occurred on my network.&amp;nbsp; 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.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Feb 2012 17:42:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/replacedatasource-not-working/m-p/181340#M13946</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2012-02-13T17:42:10Z</dc:date>
    </item>
    <item>
      <title>Re: replaceDataSource not working</title>
      <link>https://community.esri.com/t5/python-questions/replacedatasource-not-working/m-p/181341#M13947</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;To address the issue of replacing an SDE raster image with a raster mosaic, have you tried arcpy.mapping.UpdateLayer with symbology_only=False?&amp;nbsp; Author a layer file pointing to your raster mosaic and then find and update your SDE raster images found within your MXDs.&amp;nbsp; UpdateLayer has the ability to completely swap our entire layers (including data type).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jeff&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Feb 2012 13:13:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/replacedatasource-not-working/m-p/181341#M13947</guid>
      <dc:creator>JeffBarrette</dc:creator>
      <dc:date>2012-02-14T13:13:43Z</dc:date>
    </item>
    <item>
      <title>Re: replaceDataSource not working</title>
      <link>https://community.esri.com/t5/python-questions/replacedatasource-not-working/m-p/181342#M13948</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks Jeff.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The UpdateLayer method with the False parameter for symbology appears to do exactly what I need.&amp;nbsp; 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.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Feb 2012 14:40:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/replacedatasource-not-working/m-p/181342#M13948</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2012-02-14T14:40:52Z</dc:date>
    </item>
    <item>
      <title>Re: replaceDataSource not working</title>
      <link>https://community.esri.com/t5/python-questions/replacedatasource-not-working/m-p/181343#M13949</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This is still an issue.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Jan 2013 19:33:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/replacedatasource-not-working/m-p/181343#M13949</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2013-01-30T19:33:50Z</dc:date>
    </item>
  </channel>
</rss>

