|
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
|
4677
|
|
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
|
609
|
|
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
|
4676
|
|
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
|
1420
|
|
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
|
1420
|
|
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
|
1174
|
|
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
|
1174
|
|
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
|
627
|
|
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
|
1399
|
|
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
|
1908
|
|
POST
|
If an arc exists, it's centroid and true centroid will be different values. Therefore you can search each feature class to see if any centroids do not match the true centroids. Ex: lstFCs = arcpy.ListFeatureClasses("*", "Polyline")
for fc in lstFCs:
rows = arcpy.SearchCursor(fc)
print fc
for row in rows:
type = row.Shape
geom = str(type.centroid.X)
truegeom = str(type.trueCentroid.X)
if geom != truegeom:
print row.ObjectID
del row, rows This will print the feature class and the OBJECTID of any arcs within that feature class.
... View more
06-03-2011
08:50 AM
|
0
|
0
|
1908
|
|
POST
|
I would try using the commands outside of the Raster Calculator. Ex: import arcpy
from arcpy import sa
from arcpy.sa import *
arcpy.CheckOutExtension("spatial")
forest = r"c:\test.gdb\forest"
forest_slope = arcpy.sa.Slope(forest, "DEGREE", "1")
sin = arcpy.sa.Sin(forest_slope)
divide = arcpy.sa.Divide(sin, 57.2958)
multiply = arcpy.sa.Times(divide, 200)
multiply.save(r"c:\test.gdb\forest_slope_cost")
... View more
06-01-2011
08:55 AM
|
0
|
0
|
2914
|
|
POST
|
I am using Flex 2.2 and I'm having an issue where a feature service in the web application will not update after a delete or attribute change has occurred. If a feature is added, the feature service will update correctly in the web application. For example, I open a flex app with a feature service. I have the same feature service being consumed on my mobile device using ArcGIS Mobile. I'll collect a feature using ArcGIS Mobile and then post the edit back to database. Next I pan/zoom around the flex app and the feature service updates dynamically and I can see the feature. However, if I delete a feature or update attributes of an existing feature using ArcGIS Mobile, post changes back to database, and then pan/zoom around the changes are not reflected. I have to refresh the entire flex app. After doing so the changes are reflected. The same happens no matter which client I'm using to update the service. For example if I make a delete/update to the feature class in ArcMap I have to refresh the flex app. I tried setting 'mode' equal to 'onDemand' in the config file, but this did not make a difference. Has anyone experienced this? Thanks!
... View more
05-20-2011
12:10 PM
|
0
|
2
|
1072
|
|
POST
|
What user are you connecting to the database as? Is this user an administrator on the SQL Server machine? I was able to reproduce this behavior. I logged onto my machine as "Joe", created a connection SDE and created a feature called "Vector.Joe.Parcels". I then logged off of my machine and logged back on as an administrator. When I connect to SDE I can see the feature class, "Vector.Joe.Parcels" because I am an administrator. When I attempt to run my script I receive the error that the feature class does not exist. The reason being is that it is now using my current windows user, the administrator, and is therefore looking for "Vector.DBO.Parcels". Unless you are connected to the database as the feature class owner, you will need to specify the full feature class name.
... View more
05-13-2011
11:09 AM
|
0
|
0
|
1197
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 03-25-2026 04:16 AM | |
| 1 | 03-16-2026 01:00 PM | |
| 1 | 12-22-2025 10:39 AM | |
| 1 | 01-20-2026 04:04 AM | |
| 1 | 12-29-2025 06:27 AM |
| Online Status |
Offline
|
| Date Last Visited |
yesterday
|