Tag Info

Hot answers tagged

6

I was able to replicate your problem, but found a solution. You have to remove the datasets that are used by Terrain dataset first before you can delete it. A bit weird but that seems the way it must work... So the following code completely removed the FeatureDataset containing the Terrain datasets and the FeatureClass used to construct it. The order that ...


6

Use the catalogPath property of the Describe object. For example: dirname = os.path.dirname(arcpy.Describe(feat_class).catalogPath) desc = arcpy.Describe(dirname) if hasattr(desc, "datasetType") and desc.datasetType=='FeatureDataset': dirname = os.path.dirname(dirname)


6

If memory use is your prime concern, then lots of little (low vertex count) features is probably going to be more to your liking than a few very large (high vertex count) features. But you may find that "too many features" may eventually overwhelm even "too many vertices" for processing speed. If you think about how the algorithms must be structured to ...


6

A Dissolve operation will usually reduce the number of features, arcs and nodes within a layer, particularly for layers with significant lengths of shared boundaries. Since the time spent during a Buffering operation is highly dependent on the number of nodes, pre-processing with Dissolve may significantly reduce the running time (and memory requirements). ...


6

Use arcpy.env.overwriteOutput. arcpy.env.overwriteOutput = True # Execute ZonalStatisticsAsTable outZSaT = ZonalStatisticsAsTable(inZoneData, zoneField, inValueRaster, outTable, "NODATA", "MEAN")


5

The help for this tool does not explicitly state there is a limit but in a project about a year ago I was feeding it folders with many thousands of rasters and the performance was very poor. What I eventually did was SUM the rasters in batches of 100 then SUMMED the batched values. This ran much quicker and was easily implemented with a bit of looping in ...


5

You can place all the feature classes within a single dataset then use model builder to clip all at once and output to a new dataset:


4

Try using the .split Python function in the field calculator. If, for example, you have dog|cat, the .split("|") function splits the string by | into two parts ['dog', 'cat']. The [0] at the end of the function states that you want the first of the two items in the list. Finally, to be sure there are no remaining spaces in the rows, use .strip()


4

It would be better to remove the layer using arcpy.mapping.RemoveLayer. The parameters are the data frame to remove the layer from (possibly a group layer if you are trying to remove from a group) and the layer itself, this alleviates any chance of confusion: def onClick(self): mxd = arcpy.mapping.MapDocument("CURRENT") df = ...


3

(I don't have enough rep to comment so I'm answering instead.) @Michalis Avraam This isn't enirely true, a FGDB has 3 types of locks. SR - schema lock RD - read lock ED - edit lock The proposed solution by StacyR will work in all situations except for exclusive edit locks (ED) according to arcgis help documentation. ...


2

If there is, I do not know it, but if you are using an RDBMS then maybe a view or trigger can be used to maintain a field like that. For a file geodatabase there are some ArcGIS Ideas that, if implemented, would make this easy for you: Add the ability to add dynamic calculated field with formula based on other fields Dynamic Fields for Shape Features and ...


2

You are coming up against an ArcPy software limitation. Although you cannot create a GraphicElement from scratch, as long as you have one graphic element present in your layout (even if it is placed off the page), then: Existing graphic elements can be cloned and deleted. This capability was initially added to support the creation of dynamic graphic ...


2

Values other than the D8 values indicate that you have sinks in your DEM. Try the work flow shown here.. http://resources.arcgis.com/en/help/main/10.2/index.html#/Deriving_runoff_characteristics/009z0000005p000000/


2

You could try popping from your csvdict list after using a row to rename a raster: for layer in arcpy.mapping.ListLayers(mxd): for i in range(len(csvdict)): if layer.name == csvdict[i][0]: layer.name = csvdict[i][1] csvdict.pop(i) break


2

Well, the answer to that really is "It depends". Both options are very viable solutions for your problem and would likely fully be able to meet your needs. However, some things you should consider when making this decision: Model Builder uses the graphic user interface of the geoprocessing tools you are likely already used to using and the parameters in ...


2

Use the Copy Rows Tool to save the table view.


1

I would use Tabulate Area (Spatial Analyst) rather than Zonal Statistics if you are after proportions. import arcpy from arcpy import env from arcpy.sa import * env.workspace = "C:/sapyexamples/data" TabulateArea("zonedata.shp", "IDStr", "valueraster", "VALUE", "C:/sapyexamples/output/areatable.dbf", 2)


1

Your best bet for this approach would definitely be a cursor. You can create a python tool that takes 2 inputs: Feature class/table in question multi-value parameter for all the fields you are interested in The code to grab all this information is pretty straightforward: import math, itertools, arcpy FC = arcpy.GetParameterAsText(0) fields = ...


1

for MIN, MAX and MEAN, you can use the summary statistics and compute the global values accross the fields using the field calculator (min is min of min, max is max of max and mean is mean of mean in this case). For the standard deviation, it is a bit more complicated but still possible based on the partitioning of the sum of squares. Var_tot = ...


1

The .loc files generated by an address locator are plain text files. Therefore, you can modify any settings that are specified in the .loc file without the need for an arcpy function. For example, to change the minimum match score from the default to 70%: locator_fn = 'my_address_locator.loc' locator_file = open(locator_fn,'a') # open for appending ...


1

Presuming that you mean a feature selection (select by location) and not a geoprocessing intersect then I think you want ISpatialFilter. This allows the same actions as SelectLayerByLocation including overlap type options and attribute queries.



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