POST
|
Hello Mohamed, Looks like the attribute is of the type unicode which is not expected format for the name. Try this instead: import arcpy from arcpy import env env.workspace = r"C:\Users\mohamed.abdelhamid\Desktop\Python\test\rename_test.gdb" fields = ["DIS_ARB_NA","SDIS_ARB_N"] disname = [] subname = [] for fc in arcpy.ListFeatureClasses(): with arcpy.da.SearchCursor(fc,fields) as cursor: for row in cursor: disname.append(row[0].encode('ascii','ignore')) subname.append(row[1].encode('ascii','ignore')) del row, cursor for dname in disname: for sname in subname: arcpy.Rename_management(fc, str(dname + "_" + sname), "FeatureClass") Thanks, Vandana
... View more
03-23-2015
08:47 AM
|
0
|
2
|
872
|
POST
|
Hello Mohamed, Try removing the 'str' from the arcpy.Rename_management(fc, str(dname + "_" + sname), "FeatureClass"). The feature classes within database has only one row: What is data type of value that is in this row? Can you paste the contents of DIS_ARB_NA and SDIS_ARB_N fields in here? Thanks, Vandana
... View more
03-16-2015
04:30 PM
|
0
|
8
|
872
|
POST
|
That is a good point! I agree, it wont work inside the loop. Mohamed Abdelhamid Hassan Maybe try this: import arcpy from arcpy import env env.workspace = r"C:\Users\mohamed.abdelhamid\Desktop\Python\test\rename_test.gdb" fields = ["DIS_ARB_NA","SDIS_ARB_N"] disname = [] subname = [] for fc in arcpy.ListFeatureClasses(): with arcpy.da.SearchCursor(fc,fields) as cursor: for row in cursor: disname.append(row[0]) subname.append(row[1]) del row, cursor for dname in disname: for sname in subname: arcpy.Rename_management(fc, str(dname + "_" + sname), "FeatureClass") Thanks, Vandana
... View more
03-12-2015
02:08 PM
|
0
|
10
|
872
|
POST
|
Hi Joseph, Using a With statement in arcpy.da.SearchCursor will guarantee close and release of database locks and reset iteration. http://desktop.arcgis.com/en/desktop/latest/analyze/arcpy-data-access/searchcursor-class.htm - Vandana https://community.esri.com/message/467705?et=watches.email.thread#467705
... View more
03-12-2015
09:45 AM
|
0
|
12
|
1275
|
POST
|
You can also try: arcpy.Rename_management(fc, str(disname + "_" + subname)) #remove the feature class - Vandana
... View more
03-12-2015
09:24 AM
|
0
|
0
|
1275
|
POST
|
Hello Kate, Have you tried using Calculate Statistics tool before running the GetRasterProperties? for dem in demlist:
arcpy.CalculateStatistics_management(dem)
elevSTDresults = arcpy.GetRasterProperties_management(dem,"STD") Thanks, Vandana
... View more
03-12-2015
09:00 AM
|
0
|
0
|
359
|
POST
|
Hello Mohammed, Based on your title I assume you want to rename the feature classes in a workspace based on an attribute from the feature class? Can you try this: import arcpy from arcpy import env env.workspace = r"C:\Users\mohamed.abdelhamid\Desktop\Python\test\rename_test.gdb" fields = ["DIS_ARB_NA","SDIS_ARB_N"] for fc in arcpy.ListFeatureClasses(): with arcpy.da.SearchCursor(fc,fields) as cursor: disname = row[0] subname = row[1] arcpy.Rename_management(fc, str(disname + "_" + subname), "FeatureClass")
... View more
03-12-2015
08:48 AM
|
0
|
6
|
1275
|
POST
|
Hello John, Have you considered using editor tracking instead? This will create columns in the attribute table indicating the edits made to the feature class, this you can access using python. About tracking an editor's changes to data—Help | ArcGIS for Desktop Like mentioned in the previous posts, unless it is a shapefile, the date modified for file geodatabase feature class cannot be displayed in ArcCatalog. Even the edits made to the feature class, does not affect the time stamp on the geodatabase itself until all the locks are released (this is also considered an "edit" on the gdb) i.e. till the application is closed which may not be the time you stopped editing. 43164 - In ArcCatalog, why is the time stamp incorrect on the date modified field of a file geodatabase feature class? Therefore, editor tracking is definitely better option if you want to track changes made to the feature class. Feature Compare essentially compares the properties of two feature classes in terms of geometry, attrribute, schema and spatial reference. Hope this helps! Thanks, Best, Vandana
... View more
03-02-2015
10:59 AM
|
0
|
5
|
1760
|
POST
|
Hello Marco, Sorry for the delay. I tested this model in 10.2.2 and it did not crash for me. We would need to investigate further to identify the reason for the crash in the bigger model. Thanks, Vandana
... View more
03-02-2015
10:41 AM
|
0
|
1
|
1058
|
POST
|
Hello Marco, Can you elaborate on the crash issue (steps to reproduce it)? I tested this on 10.3 and it works for me (besides the error due to the % sign) without crashing. I can test on 10.2.2 and let you know what happens. Thanks, Vandana
... View more
02-27-2015
10:35 AM
|
0
|
3
|
1058
|
POST
|
Hello Marco, As you suspected the issue is due the % sign in the variable which is throwing off the inline variable substitution. It has been designed such that when ever there is a percent sign it interprets it as a inline variable substitution. A good analogy would be HTML code. You cannot use the % sign or = or < > or any of the other signs in HTML code because it means something else. Therefore inorder to replace that there are codes that indicate these symbols, as demonstrated here: HTML Codes - Table of ascii characters and symbols To workaround this in Model Builder, you can substitute the % sign in the variable as something else that will not error out and finally return the value with % after the inline substitution is done. Here is a sample (I used the HTML code for % sign to replace % in this case, however you can use whatever you want): Hope this helps! Best, Vandana
... View more
02-27-2015
08:39 AM
|
1
|
5
|
1058
|
POST
|
Hello Dan, That is correct, without extension it will be an esri grid. However, esri grid has the following limitations and if they are not met, it will error out: Storage limitation The name of a grid is limited as follows: It cannot be stored using spaces. It cannot start with a number. It cannot be longer than 13 characters (a multiband grid is allowed up to 9 characters). There is a limit to the number of files that can be stored in an INFO directory for both coverages and grids. This total is approximately 10,000. Therefore, this limits the number of grids you can store in a workspace. For example, the following lists the theoretical maximum number of grid datasets that can be stored in a single workspace directory: Fewer than 5,000 floating point grids, or Fewer than 3,333 integer grids, with VATs (fewer than 5,000 if no VATs), or Fewer than 10,000 grid stacks In addition, there is a limit on the number of characters allowed for a GRID path in windows. The path cannot be longer than 120 characters (including the GRID name) Esri Grid format—Help | ArcGIS for Desktop 35317 - Do GRID paths have a limit on the number of characters allowed on Windows platforms? Thanks, Vandana
... View more
02-26-2015
05:46 PM
|
1
|
1
|
1482
|
POST
|
Hello Marco, Can you attach a screenshot of your model and the tool that you are using for the inline variable substitution? Thanks, Vandana
... View more
02-26-2015
04:36 PM
|
0
|
7
|
1058
|
POST
|
Hello Marc, Can you try adding a .tif extension to your output raster? outRas = Int(Raster('test1') + Raster('test2')) outRas.save(destination + '\\' + 'test3.tif') -or- import os outRas.save(os.path.join(destination, 'test3.tif') Thanks, Vandana
... View more
02-26-2015
04:30 PM
|
0
|
3
|
1482
|
Title | Kudos | Posted |
---|---|---|
1 | 02-27-2015 08:39 AM | |
1 | 02-26-2015 04:13 PM | |
1 | 02-26-2015 05:46 PM | |
3 | 01-29-2015 10:39 AM | |
1 | 01-23-2015 01:51 PM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|