|
POST
|
If you're running inside ArcGIS as a script tool, you would generally collect user input with arcpy.GetParameterAsText(). myParameter1 = arcpy.GetParameterAsText(0)
myParameter2 = arcpy.GetParameterAsText(1) ^ values are now in python variables myParameter1 and myParameter2. If you're creating a standalone script, you can also use the built-in raw_input() function. myParameter1 = raw_input('Blahblah: ') ^ pops up input box and collects entered text.
... View more
03-04-2015
09:46 AM
|
0
|
3
|
1241
|
|
POST
|
"Must have 3+ years of experience" = "Entry level." Just go for it.
... View more
03-03-2015
03:03 PM
|
0
|
2
|
2704
|
|
POST
|
Maybe it's just a copy/paste error, but your message call is not within the loop. It should be more like: with arcpy.da.SearchCursor(inFeat, [fields]) as cursor:
for row in cursor:
arcpy.AddMessage("{0} | Phase: {1} | OH/UG: {2}".format(row[0], row[1], row[2])) I suspect your larger problem is that fields is just text, not a list. You will likely have to parse the semicolon-delimited string into an iterable list before referencing it in the cursor.
... View more
03-03-2015
02:55 PM
|
0
|
0
|
3239
|
|
POST
|
So, this code works, or not? It shouldn't, as your message is not indented within the for loop... Can you also clarify what "it doesn't work" means? Is there an error? If so, what is it? Finally, can you check your output: fields = "ID;Lat:Long" Are you sure these aren't all semicolons(;)?
... View more
03-03-2015
01:06 PM
|
0
|
2
|
3239
|
|
POST
|
In Python, case matters. XMin (a defined property of Extent) is different from Xmin (something unknown). You can see the exact list of valid Extent properties here.
... View more
03-03-2015
10:57 AM
|
1
|
1
|
2548
|
|
POST
|
It generally helps narrow down the problem by including the error message, but in this case, I think the problem is in referencing the elevation field (!ELEV!) rather than the variable containing the current value of the elevation field (elev) within the codeblock. Try changing return !ELEV!""" to return elev"""
... View more
03-03-2015
10:13 AM
|
0
|
1
|
1314
|
|
POST
|
Make sure the line "cursor.updateRow(row)" is at the same indentation level as the previous line ("row[2] = ...").
... View more
03-02-2015
11:16 AM
|
1
|
1
|
5598
|
|
POST
|
I would dissolve based on SRAddress, SRNumber, Type, and ItemList, which includes electronic 1, count 1, etc. You can dissolve on multiple fields, even if they all match, in order to carry those fields forward. My code above does not consider Type, but you could add it in amongst the references to SRAddress and SRNumber. I would not suggest adding new fields for each item and count in ItemList - changing the schema like this causes all kinds of problems. It's easier to parse one defined field into components.
... View more
03-02-2015
10:52 AM
|
0
|
0
|
5597
|
|
POST
|
There's probably a much simpler way to get at this (i.e. a time-saving tool or more efficient use of dictionary, etc.), but here's how you can dump the list of values into a new field ("ItemList"), then dissolve. Note that you'll have to change the feature class name, "Electronic" field name (I was using a shapefile, so couldn't fit long name), and add a text field called "ItemList". >>> valueList = [] # empty list
... with arcpy.da.SearchCursor("SR_Data",["SRAddress","SRNumber"]) as cursor:
... for row in cursor:
# get all combinations of SRAddress & SRNumber
... valueList.append(row[0]+str(row[1]))
# make unique value set
... valueSet = set(valueList)
# convert set to dictionary keys
... valueDict = dict.fromkeys(valueSet)
... with arcpy.da.SearchCursor("SR_Data",["SRAddress","SRNumber","Electronic","ItemCount"]) as cursor:
... for row in cursor:
# create comma-separated list of values matching each dictionary key
... if not valueDict[row[0]+str(row[1])]:
... valueDict[row[0]+str(row[1])] = str(row[2]) + ', ' + str(row[3])
... else:
... valueDict[row[0]+str(row[1])] = str(row[2]) + ', ' + str(row[3]) + ', ' + str(valueDict[row[0]+str(row[1])])
... with arcpy.da.UpdateCursor("SR_Data",["SRAddress","SRNumber","ItemList"]) as cursor:
... for row in cursor:
# write comma-separated list for each row, matching SRAddress & SRNumber
... row[2] = valueDict[row[0]+str(row[1])]
... cursor.updateRow(row)
... View more
03-02-2015
09:59 AM
|
1
|
3
|
5598
|
|
POST
|
I'm guessing you are talking about a web mapping services (WMS) basemap, in which case you are at the mercy of the service provider.
... View more
03-02-2015
09:15 AM
|
0
|
0
|
690
|
|
POST
|
DSM availability will highly depend on where you want it. Also, whether or not the DSM has been processed to a raster or resides in raw point data is a consideration to be taken seriously.
... View more
02-28-2015
07:46 AM
|
0
|
0
|
2329
|
|
POST
|
Fine with me, although I just copy/pasted from here: Creating and editing multipart polygons
... View more
02-27-2015
04:50 PM
|
1
|
1
|
1283
|
|
POST
|
Here is a 10.1 script you can use to calculate the data driven page rotation angle into a field called calcAngle, for an index feature class of rectangles. >>> import math
... with arcpy.da.UpdateCursor("RECTANGLE_INDEX_FEATURE CLASS",["SHAPE@","calcAngle"]) as cursor:
... for row in cursor:
... points = []
... for part in row[0]:
... for pnt in part:
... points.append(pnt)
... lines = []
... for i in range(1,3):
... lines.append(arcpy.Polyline(arcpy.Array([points,points[i-1]])))
... if lines[0].length > lines[1].length:
... firstShort = 0
... else:
... firstShort = 1
... dx = points[firstShort].X - points[firstShort+1].X
... dy = points[firstShort].Y - points[firstShort+1].Y
... ang = math.degrees(math.atan(dy/dx))
... row[1] = 360-ang
... cursor.updateRow(row)
... View more
02-27-2015
04:08 PM
|
0
|
3
|
7535
|
|
POST
|
The real operation you're looking for is Erase, which requires Advanced Licensing (which, I assume is why using the Editing Clip tool only lets you clip one feature at a time - it would be too annoying to that for all features). If you have such licensing, great, use Erase. If not, you can Union your lakes and buffers. The output will have lots of polygons, some with lake attributes, some with buffer attributes, maybe some with both lake and buffer attributes. Start editing, select those with lake attributes, and delete.
... View more
02-27-2015
03:14 PM
|
0
|
0
|
1144
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 08-30-2013 02:22 PM | |
| 1 | 04-12-2011 11:19 AM | |
| 1 | 09-17-2021 09:43 AM | |
| 1 | 04-04-2012 12:05 PM | |
| 2 | 07-16-2020 11:31 AM |
| Online Status |
Offline
|
| Date Last Visited |
07-15-2023
12:11 AM
|