|
POST
|
I would recommend using the arcpy.AddFieldDelimiters function to select the field your using. That way you can be sure you have the expression correct. Ex: fc = "Roads"
Segment_ID = arcpy.AddFieldDelimiters(fc, "Segment_ID")
Expression = "Segment_ID = 'C1'" Give that a go and see if you receive the correct results.
... View more
06-23-2011
09:40 AM
|
0
|
0
|
661
|
|
POST
|
The append should work inside or outside an edit session. If you perform the append outside of an edit session, make sure the 'Connection Details' within the connection properties of the geodatabase are set to the version you wish to update.
... View more
06-23-2011
03:48 AM
|
0
|
0
|
497
|
|
POST
|
You can use the arcpy.Append_management command to do this.
... View more
06-23-2011
03:25 AM
|
0
|
0
|
1400
|
|
POST
|
Can you upload your model as well? This will help a lot. Thanks!
... View more
06-17-2011
12:06 PM
|
0
|
0
|
3712
|
|
POST
|
I'm a little confused on your local variables: # Local variables:
Test = Expression
Test_UnsplitLine = Test
ROUTE_FINAL = Test_UnsplitLine
ROUTE_FINAL__2_ = ROUTE_FINAL
Route_Real_OUTPUT_gdb = "G:\\40\\Scratch\\Real_OUTPUT.gdb" It appears you have variables set to other variables. Could you explain what you would like the code to do and I can figure out the correct syntax? Thanks!
... View more
06-15-2011
12:27 PM
|
0
|
0
|
3712
|
|
POST
|
For your local variables you have: Test = Expression Test_UnsplitLine = Test The 'Unsplit Line' tool will be looking for feature classes and not variables. Try changing the line to: arcpy.UnsplitLine_management("Test", "Test_UnsplitLine", "Segment_ID", "") The quotes will indicate that 'Test' and 'Test_UnsplitLine" are feature classes rather than variables.
... View more
06-13-2011
07:40 AM
|
0
|
0
|
3712
|
|
POST
|
In your code, you are specifying the path and feature class. You will just need to specify the path. Ex:
brkn05 = r"T:\JOBS\1032385\Project Administration\Data In\Data_Audit_2011\Sikumiut\Raw_Data_Delivery_June12011\GDB - Current to March 2010\Project Figures\Project Discipline\Freshwater_Environment.gdb\FrshWtrEnvr_Features"
Change this to:
brkn05 = r"T:\JOBS\1032385\Project Administration\Data In\Data_Audit_2011\Sikumiut\Raw_Data_Delivery_June12011\GDB - Current to March 2010\Project Figures\Project Discipline\Freshwater_Environment.gdb" You can also simplify your code using the glob module. Ex: import arcpy, os, glob
arcpy.env.Workspace = r"T:\JOBS\1032385\Project Administration\Data In\Data_Audit_2011\Sikumiut\Raw_Data_Delivery_June12011\GDB - Current to March 2010\Project Figures\Figures MXD\test"
folder_path = arcpy.env.Workspace
# Create a list of broken workspace paths and assign to variables
brkn05 = r"T:\JOBS\1032385\Project Administration\Data In\Data_Audit_2011\Sikumiut\Raw_Data_Delivery_June12011\GDB - Current to March 2010\Project Figures\Project Discipline\Freshwater_Environment.gdb\FrshWtrEnvr_Features"
# Create a list of correct workspace paths and assign to variables
corr05 = r"T:\JOBS\1032385\Project Discipline\Freshwater_Environment.gdb\FrshWtrEnvr_Features"
for file in glob.glob(folder_path + "\*.mxd"):
mxd = arcpy.mapping.MapDocument(file)
mxd.findAndReplaceWorkspacePaths(brkn05, corr05, true)
mxd.save()
del mxd
print "Be sure to check MXDs to ensure paths have been properly assigned."
... View more
06-10-2011
04:46 AM
|
0
|
0
|
464
|
|
POST
|
Add your customized script to a Toolbox by right-clicking on the toolbox > Add > Script. Then right-click on the script > Properties and go to the Parameters tab. Here is where you can set up the parameters for the 'GetParametersAsText'. http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00150000000n000000.htm
... View more
06-10-2011
03:35 AM
|
1
|
0
|
3711
|
|
POST
|
The below code will probably give you more of what you are looking for. It will print the Group Layer and the map layer. Ex: Townships of PA\Delaware County 'Townships of PA' is the Group Layer, and 'Delaware County' is the Map Layer. import arcpy
from arcpy import env
from arcpy import mapping
env.workspace = r"C:\TEMP\PYTHON"
mxd = mapping.MapDocument(r"C:\TEMP\PYTHON\Airports.mxd")
dfs = mapping.ListDataFrames(mxd)
list = []
for df in dfs:
lyrs = mapping.ListLayers(mxd, "", df)
for lyr in lyrs:
list.append(lyr.longName)
for s in list:
if "\\" in s:
print s
del mxd
... View more
06-08-2011
06:30 AM
|
0
|
0
|
1144
|
|
POST
|
Here is an example on how to find out if a map layer is within a group layer: import arcpy
from arcpy import env
from arcpy import mapping
env.workspace = r"C:\TEMP\PYTHON"
mxd = mapping.MapDocument(r"C:\TEMP\PYTHON\Airports.mxd")
dfs = mapping.ListDataFrames(mxd)
for df in dfs:
lyrs = mapping.ListLayers(mxd, "", df)
for lyr in lyrs:
if lyr.isGroupLayer == True:
print lyr.name
del mxd
... View more
06-08-2011
04:33 AM
|
0
|
0
|
1144
|
|
POST
|
Yes, but before doing so create a database backup. It is highly recommended not to edit any repository tables within the database itself, but this is the only way I've seen to fix this issue. Once you have created a database backup, you can execute the following queries to delete the records from the 'sde.sde_table_registry' and other tables the orphaned feature class may be: select layer_id from sde.sde_layers where table_name = 'FC name'
select registration_id from sde.sde_table_registry where table_name = 'FC name'
--Apply the 2 above values to the necessary queries below
delete from sde.GDB_ITEMS where name = '<database>.<owner>.FC name'
drop table <owner>.f<layer_id>
drop table <owner>.s<layer_id>
delete from sde.sde_geometry_columns where f_table_name = 'FC name'
drop table <owner>.i<registration_id>
drop table <owner>.FC Name
delete from sde.sde_layers where table_name = 'FC name'
delete from sde.sde_table_registry where table_name = 'FC name'
... View more
06-08-2011
04:05 AM
|
0
|
0
|
829
|
|
POST
|
Does the error message reference a specific feature class? I've seen this error before when the sde.sde_table_registry contains an orphaned record from a deleted feature class. In SQL Server Management Studio, you can run the following query: select table_name from sde.SDE_table_registry This will show all feature classes within the SDE geodatabase (ignore entries that begin with 'GDB'). See if you can see if there are any orphaned entries.
... View more
06-07-2011
12:16 PM
|
0
|
0
|
829
|
|
POST
|
Here is an example on how to run the Slope tool from Spatial Analyst on a collection of individual DEMs: import arcpy
from arcpy import env
from arcpy import sa
from arcpy.sa import *
arcpy.CheckOutExtension("Spatial")
env.workspace = r"C:\DATA\DEM"
lstRasters = arcpy.ListRasters("*")
for raster in lstRasters:
outSlope = Slope(raster, "DEGREE", .3048)
outSlope.save(r"C:\DATA\DEM" + "\\" + str(raster) + "_slope.tif")
... View more
06-07-2011
04:50 AM
|
0
|
0
|
454
|
|
POST
|
When calling list fields you essentially return a copy of the field in the form of the field object, so when modifying the field alias you are modifying the field object not the actually field in the database or layer. There has been a bug logged to update the documentation stating this: NIM068561: Update the documentation for the fieldalias property and any other related properties that are listed as read and write. It should clarify that changing the property updates the field object only, it does not make an edit on the geodatabase. One workaround, though probably not ideal, I found was using the 'Field Mapping' option in the Feature Class to Feature Class tool. You can use this to update the field alias, then copy the new feature class replacing the old one. Ex: env.overwriteOutput = True
fc = "townships"
arcpy.FeatureClassToFeatureClass_conversion(fc, r"c:\temp\python\test.gdb", "Townships2", "",
"NAME \"Township Name\" true true false 100 Text 0 0,First,#,C:\\temp\\python\\Test.gdb\\townships,NAME,-1,-1")
arcpy.Copy_management("townships2", "townships")
arcpy.Delete_management("townships2")
... View more
06-06-2011
11:15 AM
|
0
|
0
|
1074
|
|
POST
|
The previous code will only work for polyline feature classes. I will have to see if there is a way to do this for polygon feature classes.
... View more
06-03-2011
09:52 AM
|
0
|
0
|
1330
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 3 weeks ago | |
| 1 | 12-01-2025 05:58 AM | |
| 1 | 11-21-2025 03:55 AM | |
| 1 | 11-14-2025 09:01 AM | |
| 1 | 11-13-2025 12:28 PM |
| Online Status |
Offline
|
| Date Last Visited |
Friday
|