|
POST
|
For what it's worth, you can make your own script that converts polyline vertices to points as simple as: in_fc = "my_layer" # change this to a layer name
out_fc = r"C:\junk\out_fc.shp" # change this to an output location
np_arr = arcpy.da.FeatureClassToNumPyArray(in_fc,'*',explode_to_points=True) # leave alone
arcpy.da.NumPyArrayToFeatureClass(np_arr, out_fc, 'Shape') # leave alone
... View more
09-22-2016
03:23 PM
|
1
|
0
|
950
|
|
POST
|
Very similar to other solutions that could be adapted to the field calculator: Python parser Expression: myfunc( !bearing! ) Codeblock: dict = {'N':[0,90],'E':[90,180],'S':[180,270],'W':[270,360]}
def myfunc(bearing):
for k,v in dict.iteritems():
if bearing >= v[0] and bearing < v[1]:
return k
... View more
09-22-2016
01:04 PM
|
1
|
4
|
6411
|
|
POST
|
I assume you're trying to calculate this into a date datatype field? I believe you need to supply a day, month, and year to fit the format. Fundamentals of date fields—Help | ArcGIS for Desktop A coverage or shapefile stores dates in a date field with this format: yyyy-mm-dd. A geodatabase formats the date as datetime yyyy-mm-dd hh:mm:ss AM or PM.
... View more
09-21-2016
10:33 AM
|
1
|
2
|
2309
|
|
POST
|
I just downloaded a KMZ from the site, saved as KML, opened in text editor, and see that I haven't saved the data at all, but a network link to the data back on the original server. I suspect that's the problem, sort of like how you can't run geoprocessing tools on a web mapping service. Is there any way to actually download the raw data from the site?
... View more
09-20-2016
05:11 PM
|
2
|
0
|
2304
|
|
POST
|
Here's a more specific page for nesting a submodel within another model: Integrating a model within a model—Help | ArcGIS for Desktop ...although, I agree that if you're ready to make a "complex" model, it is so much easier to do in Python.
... View more
09-20-2016
04:50 PM
|
2
|
0
|
1332
|
|
POST
|
Strip map index is a good starting point because it will calculate an angle field for you. Unfortunately, you don't have total control over what angle it chooses for you. I suspect this will take some amount of custom Python, but the general idea would be to calculate an angle for each line (or, probably each line split into segments of some length) into a new field and use that angle, rather than the one provided by the strip map index.
... View more
09-20-2016
11:47 AM
|
1
|
0
|
2604
|
|
POST
|
What is the exact runtime error? Also, may not be the issue, but beware the way you're writing paths. You should use raw notation or other valid path syntax to avoid escape characters. For example: fc = r"C:\MEWCo GIS System\Electric System\MEWCo_Electric_Model-LOCAL.gdb\Secondary\SERVICE_LOCATION"
... View more
09-19-2016
03:09 PM
|
1
|
2
|
2687
|
|
POST
|
I'm not 100% clear on the rules, but some of the lines in the solution above have a 3-space indent, while others have 4. I believe that once you establish a 4-space indent, you need to continue with that.
... View more
09-19-2016
12:58 PM
|
0
|
1
|
2687
|
|
POST
|
Arcpy comes with a handy function called AddFieldDelimiters to alleviate these SQL syntax errors - it encloses your field name properly within quotes, brackets, or none depending on the data source.
... View more
09-12-2016
11:03 AM
|
1
|
1
|
8924
|
|
POST
|
It is to do with parentheses, but in the sense that you need them to delineate consecutive Boolean expressions. From your link: When using multiple Boolean (~, &, ^, |) and/or Relational (<, <=, >, >=, ==, !=) operators consecutively in a single expression, parentheses should be used. For example, parentheses are required in the following expression (a>2) & (a<5). outRas = (Raster("a") > 2 ) & ( Raster("a") < 5)
So:
Con(("LULCyear2005_2006_500m_Raster" == 1) & ("soilRaster_reclass" == 1) & ("slope_reclass" == 1), 0.5, ...
... View more
09-09-2016
12:55 PM
|
1
|
0
|
2150
|
|
POST
|
Go with Joshua's answer, I was just curious to see how hard this would be in Field Calculator (as long as your IDs are reliable): VB Script (but could do the same in Python): (([PT_ID]-1)*90)-( Int(([PT_ID]/4)-0.25) *360)
... View more
09-09-2016
11:59 AM
|
0
|
0
|
1354
|
|
POST
|
I believe your original explanation can be re-written like below (every 'if' should have a corresponding 'else'). However, I think the larger problem is that you probably want to compare the row values to the input values. So, rather than comparing the user input value (Min_Age1) to 80, you want to see if the current row age value is greater than the user input value: row[3] > Min_Age1.
# Import arcpy module
import arcpy
# Set Workspace
arcpy.env.workspace = 'C:\\ECC_Test\\Output'
# Set Input Parameters
Min_Age1 = arcpy.GetParameterAsText(0)
Min_PineBA1 = arcpy.GetParameterAsText(1)
Max_PineBA1 = arcpy.GetParameterAsText(2)
Min_FI1 = arcpy.GetParameterAsText(3)
Max_FI1 = arcpy.GetParameterAsText(4)
Max_FY1 = arcpy.GetParameterAsText(5)
# Define Variables
fc = "C://ECC_Test//Output//Stands_2_t.shp"
#Update Cursor
with arcpy.da.UpdateCursor(fc, ["Hist_Comm", "FIRE_FRQ", "LAST_YR", "AGE", "PINE_BA", "ECC"]) as cursor:
for row in cursor:
if (row[0] >= 3) and (Min_Age1 >= 80) and ((Min_PineBA1 >= 40) or (Max_PineBA1 <= 60)):
if (Max_FI1 < 3) and ((Max_FY1 < 3)):
row[5] = 1
elif (Min_FI1 >= 3) and (Max_FI1 <= 6) and (Max_FY1 <= 6):
row[5] = 3
else:
row[5] = 222
print 'Did not pass second test'
else:
row[5] = 111
print 'Did not pass first test'
cursor.updateRow(row)
... View more
09-07-2016
09:58 AM
|
1
|
0
|
3002
|
|
POST
|
There are many possibilities, but getting your options into some sort of data structure (list, dictionary, table, etc.) would be my first step. Then, if the cursor values match the option values, fill in the other values. options = [[1,'Traffic Issue','Engineering','715-555-5555'],
[1,'Traffic Signal Issue','Engineering','715-555-5555'],
[1,'Vision Obstruction','Engineering','715-555-5555'],
[2,'Cracked Sidewalks','Engineering','715-555-5555'],
[2,'Curb Ramp Issue','Engineering','715-555-5555'],
[2,'Slope Issue','Engineering','715-555-5555'],
[2,'Tree or Brush Clearance Issue','Engineering','715-555-5555'],
[2,'Uneven Sidewalk','Engineering','715-555-5555'],
[2,'Other','Engineering','715-555-5555'],
[8,'Culvert Replacement','Engineering','715-555-5555'],
[8,'Ditch Flow Issue','Engineering','715-555-5555'],
[8,'Ponding Water','Engineering','715-555-5555'],
[8,'Other','Engineering','715-555-5555'],
[5,'Fire Code Violation','Fire Department','715-555-5555'],
[5,'Illegal Burning','Fire Department','715-555-5555']]
with arcpy.da.UpdateCursor(tbl, ['GeneralConcern', 'SpecificConcern', 'PrimaryContact', 'PrimaryInformation'] , where_clause = sql) as cursor:
for row in cursor:
for option in options:
if option[0] == row[0] and option[1] == row[1]:
row[2] = option[2]
row[3] = option[3]
if not row[2] and not row[3]: # not 100% sure about this
print 'No Match'
cursor.updateRow(row) # update row in table with values held in row variable
... View more
09-07-2016
09:30 AM
|
3
|
1
|
2352
|
|
POST
|
Please see da.UpdateCursor. You're going back and forth between the old (e.g. setValue) and new cursor syntax. with arcpy.da.UpdateCursor(tbl, ['GeneralConcern', 'SpecificConcern', 'PrimaryContact', 'PrimaryInformation'] , where_clause = sql) as cursor:
for row in cursor:
if row[0] == 'SomeGeneralConcern1' and row[1] == 'SomeSpecificConcern1':
row[2] = 'SomePrimaryContact1'
row[3] = 'SomePrimaryInformation1'
elif row[0] == 'SomeGeneralConcern2' and row[1] == 'SomeSpecificConcern2':
row[2] = 'SomePrimaryContact2'
row[3] = 'SomePrimaryInformation2'
elif row[0] == 'SomeGeneralConcern3' and row[1] == 'SomeSpecificConcern3':
row[2] = 'SomePrimaryContact3'
row[3] = 'SomePrimaryInformaton3'
etc.
cursor.updateRow(row) # update row in table with values held in row variable I'm not quite sure how best to set up the logic without knowing more about how you want to make decisions for primary contact and information.
... View more
09-06-2016
02:35 PM
|
1
|
3
|
2352
|
| 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
|