22

One thing that makes writing WHERE clauses a lot easier is to use the AddFieldDelimiters function, which automatically adds the correct, DBMS-specific delimiters for field identifiers, such as double-quotes for FGDB and brackets for PGDB. The other thing you have to consider is whether the value is a number, string, or other data type. Specifically, strings ...


21

Python has methods for listing feature classes in a geodatabase, looping through each feature class in the list, listing fields in each feature class, and showing the domain of each field. import arcpy #Set workspace environment to geodatabase arcpy.env.workspace = your_gdb #Get list of feature classes in geodatabase FCs = arcpy.ListFeatureClasses() #...


14

Another, maybe simpler, way is: where = '"StudyID" = ' + "'%s'" %Name


9

FeatureLayers and RasterLayers are layers created in memory, not in the scratch workspace (in background processing they create a file referencing the memory position but that is all). In order to remove those layers residing in memory, you need to explicitly delete them one by one using arcpy (they do not fall out of scope until Python exits). Note that ...


9

Very few contiguous cells in a detailed DEM will have identical values of both slope and aspect. Therefore, if the input features represent contiguous areas of common slope and common aspect, we should expect the result of this intersection procedure to have, on average, almost one feature per cell. There were originally 65,000 * 1000^2 = 6.5 E10 cells in ...


9

Based on the code you have copied, it looks like your error is arising from how you have entered the file path for your arcpy.env.workspace variable. Here is what you entered arcpy.env.workspace = r"C:\\Temp\\MuleDeer\\AllKLM5.gdb" For comparison, here is what you entered for the local variable gdb location: AllKLM5_gdb = "C:\\Temp\\MuleDeer\\AllKLM5.gdb"...


9

I would try Repair Geometry first, like you have, but I think the TopoEngine error message is spurious and really this is a resources issue. Copying the data to a new file geodatabase has sometimes got me past this error so try that first. Other things I try are rebooting before retesting, running the tool from ArcCatalog or a Python IDE or the command ...


9

Couple of suggestions: Run Check Geometry tool on your layer that you wish to clip, you could then follow that up with a Repair Geometry if it finds errors. You may wish to do that on a backed up copy. Check whether the coordinate systems are different. Perhaps you are trying to Clip a dataset in Decimal Degrees with a dataset that is in Meters or vice ...


9

I can see from your field name !DEAD_VOL_PER_HA_SPP1_125! that the field you are calculating is likely a float or integer type field. Assuming this is true, you cannot write a space or '' into a number-based field (e.g. return ''). Valid values for number-based fields include None or a numeric value. You will need to either create a new text field to ...


8

Since I don't think python handles subtypes, I'm posting this c# code that should. I tested it with Esri's sample water/wastewater geodb and found the following unused domains: HistoryType is not used PLSSFirstDivisionType is not used PLSSDirection is not used PLSSPrincipalMeridian is not used ParcelType is not used PLSSSpecialSurveyType is not used ...


8

The Dissolve tool can create a Godzilla by combining smaller (but still fairly large) features into one feature. This is known as the combinatorial problem. The Dissolve tool has logic that prevents it from creating a Godzilla (you’ll receive the warning code 000059) but this logic is based on the machine’s available memory at the time Dissolve is run. So, ...


8

The issue is in the interpretation: %Name% Expands out to the name of the feature class so the field calculation is looking for a field that matches the name of the feature class, is unable to find one, then returns an error as no field called MCD43B3.A2002001.h21v09.005.2007114212806.hdf.tif exists in the feature class. To use the name of the feature ...


7

I suggest checking what your value is in feature class in the output console. After getting the value type print featureclass featureClass = arcpy.GetParameterAsText(0) print featureClass


7

The built-in Feature Class to Feature Class tool does everything you want. If you want more control than that, you can create a script tool and customize its validation behavior if necessary (for example, to list all the unique values of a chosen field). To simply provide a drop-down of available fields you don't need to customize the behavior, just set up ...


7

With cursors and the "SHAPE@" token, a geometry object is returned. The getPart() method returns an Array containing all the points for that particular part. Interestingly, field calculator also returns a geometry object, but the getPart() method does not appear to return an array, although it is something similar. Maybe an unpacked array? Luckily, arcpy ...


6

I had a similar problem with the Tabulate Intersection tool (using 10.4). I found the suggestion to place the resulting table into a geodatabase from here: https://geonet.esri.com/thread/13680 It fixed the problem!


6

You almost had it right with your first attempt. What you are doing is trying to call the extent property with a filename as its parameter, when you need to construct a Raster object with that parameter. In practical terms, that means: extent1 = arcgisscripting.Raster('stg1_05.jpg').extent Although it is usually better practice to break it down into two ...


6

Try PatchFinder from the ESRI Support site. Also before you go too far down that rabbit hole you might just uninstall and reinstall ArcGIS on the problem machine. It's likely not a reproducible error if it only happens in a 400-element model.


6

It looks like you've mixed up the usage of the 'old' cursors (arcpy.SearchCursor) and 'new' cursors (arcpy.da.SearchCursor). You are using the 'old' cursors, so you need to pass the name of the field to getValue, not the field index. So in your case, change row.getValue(1) to row.getValue(fields[1]). Also, there's no need to have all of the or statements ...


6

You should change "Log" to "math.log" . If you want to use your code in Field Calculator, just use formula in it: 0.3-.001*math.log(!Field1!+1)-0.02*math.log(!Field2!+1)-0.04*math.log(!Field3!+1) In Python IDE: You need to assign "PYTHON_9.3" to the last parameter of the "arcpy.CalculateField_management". Don't forget import arcpy in the beginning of ...


5

This code should return what is being asked. It will succinctly traverse all feature classes and tables in a workspace GDB/FS and return all fields associated with a domain, the field name, and the feature class/table it belongs in. import os import arcpy lst=[] for dirpath,dirnames,files in arcpy.da.Walk( # the path to your workspace , datatype=["...


5

Your need to convert your SQL into VBA or Python for the Field Calculator in ArcMap http://webhelp.esri.com/arcgiSDEsktop/9.3/index.cfm?TopicName=Making_field_calculations ArcGIS 10 Users can also use Python scripts in ArcGIS Field Calculator This is a cheaper option than buying ArcSDE and a database that supports SQL.


5

The problem is that your code defines raster_outputpath but you try to save the raster in raster_output. Change this line: arcpy.PolygonToRaster_conversion(featureClass, "CLASS", raster_output, "CELL_CENTER", "NONE", "30") To: arcpy.PolygonToRaster_conversion(featureClass, "CLASS", raster_outputpath, "CELL_CENTER", "NONE", "30")


5

While I couldn't solve the original problem with the tool Extract Values to Points (Spatial Analyst), I was able to instead use the tool Extract Multi Values to Points (Spatial Analyst). This tool worked with no issues and instead of creating a new output, it simply appended the DEM elevation values to my existing point file.


5

I believe the problem might be in your coordinate system definitions -- ref. the Project Raster help page. The coordinate system to which the input raster will be projected. The default value is set based on the Output Coordinate System environment setting. Valid values for this parameter are A file with the ".prj" extension (the prj ...


5

You're tripping over your own feet here.. All cursors need to be removed or they will lock the data; until you free the cursor you could still go back to it at any stage. In your code you're using a mixture of old and new style cursors, I wouldn't, try to stick to one or the other. They both work but I would use arcpy.da cursors exclusively. Older style ...


4

The parameters that you currently have set up should not actually be "output" parameters, as they are simple string arguments to your geoprocessing methods, not true outputs. There are two ways you can go about this: Replace your two "Output Location" and "Output Table" parameters with a single output parameter of type Table to supply the full path to the ...


4

Unfortunately Brian's answer, which is a direct and usable answer the question asked, does not solve my actual problem. I presume because of a bug in the gdb at hand (even though none of the feature classes have domains attached, there is still one I'm not allowed to delete). In any case I found another method for determining which fc's have associated ...


4

With respect to the line throwing the error: value = row.getValue(field)* row.UNpctOfEd maybe check the data type or value in each of the f and UNpctOfEd fields? Check note 1 below. If all input fields are similarly named, you might also want to generate your fieldList with the List Fields function instead of typing it out: # list fields for calculations ...


Only top voted, non community-wiki answers of a minimum length are eligible