7

Your code is returning "unexpected" results because you are mixing client-side Javascript control structures with server-side Earth Engine methods. In general, you should avoid doing this. Review the Earth Engine Client vs. Server docs page for a complete discussion. For your simple example, you can use an ee.List() object to accumulate values, and later ...


6

loc primarily "label of the index" based. So, for the first iteration gdf1['NAME_2'][0] returns muni1. Then you get error using gdf1.loc['muni1'], because Pandas interprets 'muni1'('Abad') as index label, but it's value of NAME_2 You should change munis = gdf1.loc[gdf1['NAME_2'][i]] into gdf1.loc[gdf1['NAME_2'] == gdf1['NAME_2'][i]] in for loop.


5

Your code is correct, your indent is misplaced. Try this: length = [1990, 2016, 3051, 3279, 1855, 3432, 4323, 3016, 4218] for le in length: if le < 3000: buffer_width = "75 Feet" elif le > 4000: buffer_width = "300 Feet" else: buffer_width = "175 Feet" print le,buffer_width


5

you need to add the export function inside the for loop, indent the line for bkmk in bkmks: mf.zoomToBookmark(bkmk) lyt.exportToPDF(r"C:\arcGIS_Shared\Exports" + "\\" + bkmk.name + ".pdf")


5

Although Hornbydd is absolutely correct (+1 for that by the way), the first part of the question is to loop through all the unique values in a field.. this snippet should be usable in your existing code: FieldToUse = "Field" # change this to your field name with the unique values for fc in fcList: uVals = [] # new empty list # loop through each ...


5

Use a dictionary: The main operations on a dictionary are storing a value with some key and extracting the value given the key. d = {1:"Lightning", 2:"Equipent use", ... } with arcpy.da.UpdateCursor(fc, ["CAUSE_TEXT", "CAUSE"]) as cursor: for row in cursor: if row[1] in d: #Check if value of row[1] exists in dictionary row[0] = ...


4

I would isolate the class you are after rather than searching for it. Then, simply assign row[1] that isolated value. For example: in_table = 'l12wm_agsup02.img' field_names = ['Class_Name', 'crop'] with arcpy.da.UpdateCursor(in_table, field_names) as cursor: for row in cursor: row[1] = row[0].split("-")[2].split(".")[0] cursor.updateRow(...


4

Here are four approaches. The first uses the arcpy Walk function. The second, third, and fourth approaches use built-in python modules. The fourth approach is the one you provided. Here are the time benchmarks to recursively search a large directory: Method 1: 15.0 seconds (arcpy.Walk) Method 2: 140.0 seconds (os.Walk and fnmatch.filter) Method 3: 4.0 ...


4

At the time of you listing features: inputfc2 = arcpy.ListFeatureClasses("*.clip"). They dont exist, you create them later. And shouldnt "*.clip" be "*_clip"? So feature class to feature class and delete will have nothing as input. (Test it with print inputfc2) Move the list line to after the clip.


4

I see the very last line as error-ing out as inpfile is not defined anywhere. You also didn't store the selection set as a variable or test whether the returned selection layer had any records before copying. try this. # Generate list of shapefiles in the workspace # Copy shapefiles in a list that intersect a polygon to a new location import arcpy, os # ...


3

If you read the help file for this tool and look at the syntax section what does it takes as input? A Feature Layer. Unlike a Feature Class, you can do selections on Feature Layers. As all geo-processing tools honour selections first all you need to do is select the points of interest and have that selection feed into the Kernel Density tool. So you need to ...


3

The problem is that you re-define rasNumber = 1 in each iteration, so you will be accessing the same raster in each iteration. This would not result in infinite loop though, because the for loop will exhaust once all raster files are iterated (of course you would get wrong results as the same - the first - raster was used). You should move this line ...


3

I corrected your code for you. After each line you find a comment to show you what was corrected. Also reading about about for loops, the range and len functions can help you understand the changes. import arcpy #from arcpy import env #this line can be removed arcpy.env.workspace = r'D:\Documents\Archaeology\Dissertation\Data\GIS\Places_Bounds\Places\...


3

Your buffer_width being a variable is getting changed on every iteration of your loop. If you want the the value of buffer width for each element in length, you'll need to define buffer_width as a list. Try- length = [1990, 2016, 3051, 3279, 1855, 3432, 4323, 3016, 4218] buffer_width = [] for le in length: if le < 3000: buffer_width.append("...


3

Try replacing: arcpy.env.workspace = "H:\GIS Project\Bulk Density\In Rasters" with: arcpy.env.workspace = r"H:\GIS Project\Bulk Density\In Rasters" or: arcpy.env.workspace = "H:\\GIS Project\\Bulk Density\\In Rasters" or: arcpy.env.workspace = "H:/GIS Project/Bulk Density/In Rasters" The backslash is a special character to Python and so strings for ...


3

You seem to be using the Project tool which is for vector data. You need to use the Project Raster tool which is for rasters.


3

Change: f=arcpy.GetCount_management(TL) To: f=int(arcpy.GetCount_management(TL).getOutput(0)) Without getOutput, f is a Result object, not the actual count. Example: import arcpy fc = r"C:\Test\Buildings.shp" arcpy.GetCount_management(fc) <Result '9'> arcpy.GetCount_management(fc).getOutput(0) '9' int(arcpy.GetCount_management(fc).getOutput(0)) 9


3

The problem is in the fact that what you wrote is different from what you think you wrote. The comment says "retrieve the first item", but what really happens is "build a list that consists of the first item of every entry in the big list". bigFC = [itemA[0] for itemA in bigNeighborList] #retrieve the first item subtype = [itemA[1] for itemA in ...


3

If your end goal is to create a separate shapefile for each river and all its tributaries. You could try this approach using a recursive query (@Taras check this out :) ) I am assuming the main rivers layer 'rios_linha_costa' has a column containing the name of the river called "river_name". Create a Virtual Layer (through Layer > Add Layer > Add/...


3

You could use Result.GetMessage/GetMessages, instead of arcpy.GetMessage/GetMessages For example: import arcpy def log(result): # Last message print(result.getMessage(result.messageCount-1)) # Or all messages... # print(result.getMessages()) log(arcpy.SomeTool_toolbox(some_input)) log(arcpy.AnotherTool_toolbox(some_input))...


3

There is no argument filename in writeLAS(). The signature of writeLAS() is writeLAS(las, file)


3

An alternative method is to create a table and store your floats in that, 1 row per float value. Then use the Iterate Field Value iterator to drive your model. But I think @user2856 has the simplest solution.


3

You can use the Iterate Multivalue tool and add a list of floats:


3

As per @Vince's comment, you need to fully qualify the paths to your feature classes by prepending the appropriate path the to file geodatabase they come from. For example, by using a list comprehension: FC_list = [os.path.join(arcpy.env.workspace,fc) for fc in arcpy.ListFeatureClasses()]


3

You can solve this using da.UpdateCursor: import arcpy fc = r'C:\folder\data.gdb\polygons123' #Change field_to_hold_the_nonNonevalue = 'somefield' #Change #List all fields starting with AVGPRE, and add the field to update last in list fieldlist = [f.name for f in arcpy.ListFields(fc, 'AVGPRE*') if f.name != field_to_hold_the_nonNonevalue] + [...


3

Your code (the loop) does not run and does not show the error. Without that is very difficult to help, but I will try. The error occurs here future.Rast.mask[[futureYears]] Because you are using years (1970, 1972, 1973, ...) as an index. You would need to have that many (>1970) layers for that to work. It should be an index like (1, 2, 3, 4, ...). That ...


3

I fixed U90 ref and following version of your code works as you expected. I used my own paths for verification purpose. Delete them an uncomment yours. It is also necessary to change 2 for 12 in corresponding loop. import qgis import gdal from qgis.analysis import QgsRasterCalculator, QgsRasterCalculatorEntry from qgis.core import QgsRasterLayer #U90 = ...


3

I can help you get started with listing all raster and grouping them by day: import os, datetime from collections import defaultdict as dd rasterfolder = r'/home/bera/Desktop/test/' rasterlist = dd(list) for root, folder, files in os.walk(rasterfolder): for file in files: fullname = os.path.join(root, file) if file.endswith('.tif'): ...


2

Your rasterlist items include full paths, so when you try to create an output name tx_name you are creating that with the full path. n1992_USA = "C:\\Angela\\OK\\nlcd_1992_30meter_whole (1)\\nlcd_1992_30meter_whole.img" n2001_USA = "C:\\Angela\\OK\\nlcd_2001_landcover_2011_edition_2014_10_10\\nlcd_2001_landcover_2011_edition_2014_10_10\\...


2

You don't need a nested loop (and it's written in a wrong way because you will scan your table only once) So. First of all read all the data from the table and sum it up. data = {} with arcpy.da.SearchCursor(table_datei, ["src_FID", "LENGTH"]) as sc: for row in sc: try: data[row[0]] = data[row[0]] + row[1] except KeyError: ...


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