POST
|
You could manually create an empty MXD called 'Test.mxd'. Then you can use python to add all the layer files from the directory, update the description, and delete MXD when you're finished. Ex: import arcpy, os
from arcpy import env
arcpy.env.overwriteOutput = True
env.workspace = "<lyr file workspace>"
mxd = arcpy.mapping.MapDocument(r"C:\temp\Test.mxd")
df = arcpy.mapping.ListDataFrames(mxd, "*")[0]
listFiles = arcpy.ListFiles("*.lyr")
for file in listFiles:
addLayer = arcpy.mapping.Layer(file)
arcpy.mapping.AddLayer(df, addLayer)
arcpy.RefreshTOC()
arcpy.RefreshActiveView()
for lyr in arcpy.mapping.ListLayers(mxd):
lyr.description = "N/A"
lyr.saveACopy(str(lyr))
del mxd
os.remove(<'PathToMXD>')
... View more
04-19-2011
04:13 AM
|
0
|
0
|
643
|
POST
|
I just wanted to note that an aux.xml can exist when statistics do not. For example, the aux.xml will also be used as a pointer to the pyramid file. This is explained here: http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//009t00000027000000.htm You may want to go along the lines Niklas mentioned. Ex: try:
arcpy.GetRasterProperties_management(input, "STD")
print "Statistics exist"
except arcpy.ExecuteError:
arcpy.CalculateStatistics_management(input)
print "Statistics were calculated"
... View more
04-19-2011
03:21 AM
|
0
|
0
|
1027
|
POST
|
I believe Heather's solution is correct. Here is a script that you can use to delete empty feature classes just in case: import arcpy
from arcpy import env
env.workspace = r"C:\Temp\Test.gdb"
listFCs = arcpy.ListFeatureClasses("*")
for fc in listFCs:
count1 = str(arcpy.GetCount_management(fc))
if count1 == "0":
arcpy.Delete_management(fc) You can easily turn this into a tool by changing 'env.workspace' to: env.workspace = arcpy.GetParameterAsText(0) Then import the script into ArcToolbox and set an input under the Parameters tab within the Properties.
... View more
04-18-2011
08:00 AM
|
1
|
1
|
1201
|
POST
|
Also, you should note the following with Mosaic Datasets in SDE. When the ArcGIS client connects to SDE as the database user it will only have read privileges to the mosaic dataset overviews. The overviews, by default, are stored in the SDE geodatabase. Once you zoom into a large enough scale you will be accessing the raw imagery on disk. Therefore, the windows user from the ArcGIS client will need read privileges to the imagery.
... View more
04-18-2011
07:09 AM
|
0
|
0
|
547
|
POST
|
I think there may be a bug with the mapping.findAndReplaceWorkspacePaths function. I've been running some tests with ArcGIS 10 SP1 and cannot seem to get this to work. For example, I tried a simple test and the paths would not update: import arcpy
mxd = arcpy.mapping.MapDocument(r"C:\Temp\Fires.mxd")
mxd.findAndReplaceWorkspacePaths(r"C:\TEMP\test.gdb", r"C:\Temp\Python_Test.gdb")
mxd.saveACopy(r"C:\Temp\Project2.mxd")
del mxd I would recommend escalating this matter to tech support.
... View more
04-08-2011
12:22 PM
|
0
|
0
|
1036
|
POST
|
Try using the replaceWorkspaces function: import os, arcpy
folder = r"C:\TEMP"
for (path, dirs, files) in os.walk(folder):
for file in files:
if file.endswith(".mxd"):
mxd_path = os.path.join(path, file)
mapdoc = arcpy.mapping.MapDocument(mxd_path)
mapdoc.replaceWorkspaces(r"C:\DATA\Philadelphia.gdb", "FILEGDB_WORKSPACE",
r"Database Connections\SQL - VECTOR@VECTOR.sde", "SDE_WORKSPACE")
mapdoc.save()
del mxd_path
del mapdoc
... View more
04-08-2011
09:32 AM
|
0
|
0
|
1036
|
POST
|
Here is an example on how to add the layer file to your current MXD: import arcpy
from arcpy import mapping
mxd = mapping.MapDocument("CURRENT")
df = mapping.ListDataFrames(mxd, "Layers")[0]
addLayer = arcpy.mapping.Layer(r"C:\DATA\PA_DEM.lyr")
mapping.AddLayer(df, addLayer)
arcpy.RefreshTOC()
arcpy.RefreshActiveView() Here is an example on how to add the layer file to a particular group layer in your current MXD: import arcpy
from arcpy import mapping
mxd = mapping.MapDocument("CURRENT")
df = mapping.ListDataFrames(mxd, "Layers")[0]
targetGroupLayer = mapping.ListLayers(mxd, "L00 (147,748K)", df)[0]
addLayer = mapping.Layer(r"C:\DATA\PA_DEM.lyr")
mapping.AddLayerToGroup(df, targetGroupLayer, addLayer, "BOTTOM")
arcpy.RefreshTOC()
arcpy.RefreshActiveView()
... View more
04-08-2011
04:23 AM
|
0
|
0
|
350
|
POST
|
I believe that I am trying to do something similar in Arcsde 10. I am trying to use a stand alone table with updated property ownership changes lined to parcel account numbers. Would a "relate" know to replace certain attribute fields with the data from the stand alone table? Is this something that would require a script? I'm not very versed in scripting yet but wouldn't mind giving it a shot. The relate will only link the feature class to the stand alone table using a primary and foreign key so when you select a parcel, you can see all the related information in the stand alone table. Are you looking to have attributes in the feature class update from the related table attributes?
... View more
04-08-2011
02:47 AM
|
0
|
0
|
489
|
POST
|
I found you can use field alias' with the following widget: http://www.arcgis.com/home/item.html?id=4ec33120c9ea4d019fddf722fc34ea3c
... View more
04-05-2011
05:59 AM
|
0
|
0
|
303
|
POST
|
Hello, I am using the sample viewer for Flex, version 2.2. I am trying to configure the Info Popup Widget to use the field alias rather than the field name. Is there a way to do this w/o having to change the code using Flash Builder? I am hoping to just edit the XML file for this change. Thanks!
... View more
04-05-2011
04:34 AM
|
0
|
2
|
549
|
POST
|
This looks to be a bug with the ListLayoutElements function. The "SHEET*" wildcard should be returning the text elements that begin with "SHEET". I would recommend reporting this to tech support so they can document this bug. I haven't been able to find a workaround yet, but I'll keep looking a little bit longer.
... View more
03-31-2011
09:46 AM
|
0
|
0
|
640
|
POST
|
You will need to add 'arcpy.RefreshActiveView()' at the end of your code. Try the following: import arcpy mxd = arcpy.mapping.MapDocument(r"CURRENT") for elm in arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT", "*SHEET*"): if elm.type == "TEXT_ELEMENT": elm.text = "SHEET 7001" arcpy.RefreshActiveView() Note: I also had to add an '*' in front of SHEET for the wildcard to work correctly.
... View more
03-31-2011
07:10 AM
|
0
|
0
|
640
|
POST
|
With the relate, if you add the service to ArcMap and use the identify tool you can drill down to the related dbf table. I have not tested this with a web application though.
... View more
03-30-2011
10:08 AM
|
0
|
0
|
489
|
POST
|
Currently, there doesn't appear to be a way to convert labels to an annotation feature class using python. However, there has been an enhancement request logged for this functionality: NIM003923 'Create Featureclass' tool should have an options to create Annotation or Dimension classes, to match ArcCatalog's New Feature Class functionality.
... View more
03-30-2011
08:59 AM
|
0
|
0
|
239
|
POST
|
Yes, this will work. What you will have to do is set up a relate in ArcMap. However, you need to have matching records in the feature class that match that of the DBF table. For example, a parcel ID number. The field names do not have to be the same, but the values do. You can create the relate by right-clicking on the feature class in ArcMap > Joins and Relate > Relate. After the relate is created, save the map document and then publish it to ArcGIS Server. As the DBF table is updated with the application, the service will automatically reflect these changes. Note: this relationship is only maintained in this map document. If you add the feature class to another map document, you will have to recreate the relate.
... View more
03-30-2011
08:50 AM
|
0
|
0
|
489
|
Title | Kudos | Posted |
---|---|---|
1 | Thursday | |
1 | Thursday | |
2 | Tuesday | |
4 | 01-17-2024 12:38 PM | |
1 | 08-23-2024 11:26 AM |
Online Status |
Offline
|
Date Last Visited |
6 hours ago
|