|
POST
|
Brittney: Have you thought of trying to use the replaceDataSource method to solve this problem? I'm thinking you could create the new direct connect database connections in ArcCatalog that would correspond to your existing database connections. Then in your code, get each feature class in your mxd that originate from this database and replace the old connection with the new direct connection. Use the Validate = TRUE property so only those existing connections that you have created a corresponding direct connection for will be resourced (if set to FALSE, you will get broken links if the connection strings have not been already created in ArcCatalog). I hope this helps.
... View more
02-07-2012
06:37 AM
|
0
|
0
|
817
|
|
POST
|
Here is the link to setup a script tool where you can add a parameter to the script as as input: http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Adding_a_script_tool/00150000001r000000/ I followed this ESRI Help myself and I was able to setup a tool that would walk through all the subdirectories in a user selected directory.
... View more
02-07-2012
06:20 AM
|
0
|
0
|
1363
|
|
POST
|
Have you thought about trying root = arcpy.GetParameterAsText(0) where you are passing this as a value that the user can navigate to if you set it up as a directory in an ArcToolbox script? This is how I am able to achieve what you want to do in your script.
... View more
02-07-2012
06:08 AM
|
0
|
0
|
1363
|
|
POST
|
To All Python Users: I have a script that is updating mxds and then saving them. After saving the mxd I am deleting the mxd object, but memory usage keeps increasing until the python script just hangs. I have read that I can use a subprocess to fix this problem, but I am unsure of the syntax to use. I will be drilling down through a directory and all of its subdirectories for mxd files (This will be my main python script). Once I have an mxd file as the focus, I want to use a subprocess to start another python script that will open the mxd, replace data sources, save the mxd and then delete the mxd object from memory. Then I will return to the main script to get another file which should free up memory as the subprocess has terminated. Does anyone know the syntax I would use to call the secondary python script with an argument being the mxd file that has the focus? Any help or hints are greatly appreciated. Thank you.
... View more
02-07-2012
04:40 AM
|
0
|
17
|
7168
|
|
POST
|
Thanks Jake. Do you have any idea why I need to employ this more complicated workaround than your original simpler code?
... View more
02-03-2012
09:51 AM
|
0
|
0
|
236
|
|
POST
|
Jake: Do you think it might matter how the SDE connection is broken? I created a new SDE version owned by myself off the default version. I added data from SDE with this version to an mxd and saved the mxd. I then deleted the SDE version in ArcCatalog which breaks the link. I then ran my python script on this mxd with the broken SDE link.
... View more
02-03-2012
09:03 AM
|
0
|
0
|
1341
|
|
POST
|
Jake: As requested, here is my code that returns different results from your code: import os, arcpy, sys
from arcpy import env
env.overwriteOutput = True
mxd_match = ".mxd"
for root, dirs, files in os.walk(arcpy.GetParameterAsText(0)):
fListLength = len(files)
if (fListLength != 0):
n = 0
for f in files:
if f.endswith(mxd_match):
full_path = root + "\\" + str(f)
try:
mxd = arcpy.mapping.MapDocument(full_path)
broken = arcpy.mapping.ListBrokenDataSources(mxd)
for n in broken:
for lyr in arcpy.mapping.ListLayers(mxd, n):
arcpy.AddMessage("The broken SDE layer dataSource is " + lyr.dataSource)
del mxd
except:
print arcpy.GetMessages(2)
... View more
02-03-2012
08:07 AM
|
0
|
0
|
1341
|
|
POST
|
Jake: I modifed my code slightly to duplicate your code and I am still receiving dataSource property for an SDE feature class was \'feature class dataset name.feature class name' (e.g. ADMIN_BOUNDARIES.MUNIS) instead of something like Database Connections\SDEConnection.sde\vector.VECTOR.ap for an SDE broken link. I was able to get the dataSource property in your format if I called this property from an SDE feature class that was not broken, so I'm guessing that the dataSource property works differently if the SDE connection is broken. Should I place a call with ESRI Technical Support for further assistance with this issue? Thanks.
... View more
02-03-2012
07:34 AM
|
0
|
0
|
1341
|
|
POST
|
Jake: The following code did not work for me to identify an SDE feature class because '.sde' did not appear in the dataSource property that I printed out to the progress window. Are you sure '.sde' is supposed to be in the dataSource property for an SDE feature class? All that showed up in the dataSource property for an SDE feature class was \'feature class dataset name.feature class name'. mxd = arcpy.mapping.MapDocument("C:\TEMP\python\Airports.mxd") broken = arcpy.mapping.ListBrokenDataSources(mxd) for n in broken: for lyr in arcpy.mapping.ListLayers(mxd, n): if '.sde' in lyr.dataSource: print lyr.name del mxd.
... View more
02-03-2012
06:35 AM
|
0
|
0
|
1341
|
|
POST
|
To All Python Users: I am using the ListBrokenDataSources method in python to get all the broken datasources in an mxd. Now I want the ability to determine the type of connections, specifically SDE, that the broken links are. I tried to loop through the list of broken data source layers and use the serviceproperties method to determine if it was SDE, but that is returning an error. Does anyone know if this can be done? If so, what python method would I use to go about getting this information. Thanks.
... View more
02-03-2012
05:02 AM
|
0
|
10
|
2010
|
|
POST
|
Jeff: Do you have to use mxd.saveACopy(r"C:\Project\Project2.mxd") in order for this script to replace the datasource? I would like to create a similar python script, but I do not want to create an additional copy of the file as users could have short-cuts on their desktops to the mxd which would now be broken. Can I just overwrite the existing mxd instead of creating a new mxd? Your feedback is greatly appreciated. Thanks. Mike
... View more
01-17-2012
10:27 AM
|
0
|
0
|
1200
|
|
POST
|
Jeff: Does ESRI have a tentative date of when service pack will be available to all users? Does this push back the date of release of ArcGIS v10.1? Your feedback is greatly appreciated. Thanks.
... View more
01-12-2012
05:50 AM
|
0
|
0
|
1200
|
|
POST
|
Joel: You wrote "We're currently using Oracle database 10.2.0.4, but I have both Oracle 10 and Oracle 11 clients on my machine, and I can use either version of the client and still get the same results for the things we do." When you are connecting to Oracle database 10.2.0.4 thru the Oracle 11 client, you are not able to access new Oracle 11 functionality, correct? The only way to get Oracle 11 functionality is to have both the database and client upgraded to the 11 version, correct?
... View more
06-28-2011
10:50 AM
|
0
|
0
|
877
|
|
POST
|
Joel: My organization should be able to leave the Oracle10g connection information intact if we upgrade the Oracle server to 11g, but leave the clients at 10g? Is there new functionality of Oracle11g that would not be available if we leave Oracle Client at 10g on the client machines? Is the Oracle10g Client compatible with Oracle 12g, so we would be able to leave the connection information as is with an upgrade of Oracle Server to 12g? Your help and feedback is greatly appreciated. Thanks.
... View more
06-28-2011
08:45 AM
|
0
|
0
|
877
|
|
POST
|
To All ArcSDE Users: My organization is in the process of upgrading the Oracle database from 10g to 11g. As a result the Direct Connection information will need to be changed on tens of thousands of connections within our mxds, because the Service parameter needs to be changed from sde:oracle10g to sde:oracle11g. In order to avoid this vast amount of work in the future, I was wondering if this information can be stored as an Environmental Variable that would be read in when the mxd is opened up. In this way, when my organization upgrades the Oracle database in the future, only the Environmental Variable would need to be modified. Any help or hints are greatly appreciated. Thanks in advance.
... View more
06-28-2011
03:10 AM
|
0
|
6
|
1444
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 09-26-2025 06:10 AM | |
| 1 | 09-04-2025 02:19 PM | |
| 1 | 08-29-2025 08:29 AM | |
| 1 | 08-21-2025 12:45 PM | |
| 1 | 07-25-2025 09:09 AM |
| Online Status |
Online
|
| Date Last Visited |
15 hours ago
|