POST
|
Thanks, I may have tagged the question incorrectly, looking for label expression syntax for the Maplex Label Engine in Arcmap
... View more
07-06-2018
07:58 AM
|
0
|
1
|
614
|
POST
|
Need python label expression to label linear assets in Arcmap 10.3 with length (rounded to nearest whole number) with a foot symbol(') at the end, plus a space, then text from a different field. Have this so far: round(float( [LLENGTH]), 0)
... View more
07-06-2018
07:08 AM
|
0
|
4
|
1215
|
POST
|
The dataset is relatively small so I don't need a dictionary. Basically just looking for the python version of this VBScript that I found: Function FindLabel ( [RelateFieldofLayer] ) Set gp = CreateObject("esriGeoprocessing.GPDispatch.1") strWhereClause = chr(34) & "RelateFieldofTable" & chr(34) & " = '" & [RelateFieldofLayer] & "'" strpTable = "PathToRelatedTable" Set prows = gp.searchcursor(strpTable,strWhereClause) Set prow = prows.next Do until prow is nothing strLabel = prow.LabelField FindLabel = FindLabel & strLabel & vbnewline Set prow = prows.next Loop End Function
... View more
04-25-2016
02:39 PM
|
0
|
1
|
666
|
POST
|
Looking for a label expression that will label from a relate. It's a 1-to-many situation & desired result is to stack the labels from a field in the related table. For example, it would be how a city would label tenants in one building, or like labeling residents (listed in a xls) on 1 apartment building.
... View more
04-18-2016
08:16 AM
|
0
|
3
|
4560
|
POST
|
Attempting to use an update cursor to update a field 'Cost' by multiplying the value in the field 'Area' by a value input by the user. The trouble seems to be getting the variables "Price1" and "Price2" to work inside the cursor's If statements. If I simply replace the variable with a number, such as 2, then the script works fine, but it really needs to multiply a variable that the user has entered. The variable that the user enters will be a money value, so it's of type Double with 2 decimal places. The error I get is "can't multiply sequence by non-int of type 'float'". Here's a snippet of the code: Price1 = arcpy.GetParameterAsText(0) Price2 = arcpy.GetParameterAsText(1) fcName = "My_lyr" fields = ['Area','Description','Cost'] #Note that 'Area' is type DOUBLE, 'Description' is TEXT, and 'Cost' is DOUBLE CostCursor = arcpy.da.UpdateCursor(fcName,fields) for row in CostCursor: if row[1] == "Category 1": row[2] = (row[0] * Price1) elif row[1] == "Category 2": row[2] = (row[0] * Price2) else: row [2] = 0 CostCursor.updateRow(row) del row del CostCursor
... View more
11-15-2013
04:33 PM
|
0
|
2
|
406
|
POST
|
Basically I want to select line features based on a polygon feature, then return a value that is the sum of all the features in a field that is within the selected set of line features. Then do this for say, a hundred more feature classes. I figured there would be a tool, called GetSum or something similar that would do this but did not see it in the Help. I've explored using Summary Statistics, but that returns a table, not a simple value. Here is what I've got. Ideas? # Create a list of all the polygon feature classes zonePolys = arcpy.ListFeatureClasses("Zone*") for fc in zonePolys: arcpy.AddField_management(fc,"SumOfValues","LONG") arcpy.MakeFeatureLayer_management("OriginalLayer", "OriginalLayer_Lyr") arcpy.SelectLayerByLocation_management("OriginalLayer_Lyr","INTERSECT",fc) # Calculate the sum of the values in the selected features in OriginalLayer_Lyr SumValues = ?? # Take the sum value of the line features field and populate the polygon layer's new SumOfValues field with it arcpy.CalculateField_management(fc,"SumOfValues",SumValues)
... View more
10-31-2013
10:47 AM
|
0
|
3
|
3310
|
POST
|
Ok, imagine there are 3 fields in a table: Field1, Field2, and and empty Field3. All I want to do is multiply Field1 * Field2 and populate the result in Field3. This is easily done in the field calculator in ArcMap, but what does the code look like in a python script? I am assuming that the arcpy tool I need is Calculate Field, but am not 100% certain. The part I am stuck on is what does the 'expression' look like in the code line below... or if a different tool is better, what is it? CalculateField_management (in_table, field, expression, {expression_type}, {code_block})
... View more
10-28-2013
11:10 AM
|
0
|
2
|
818
|
POST
|
How can I update a field based on if the date in another field has passed or not? In other words, which arcpy function or method can be used that will change an attribute from "current" to "expired" when the date in the date field associated with that feature has passed? The goal is to have a tool/button that updates the features based on date and then exports to pdf.
... View more
06-07-2013
11:46 AM
|
0
|
2
|
597
|
POST
|
Trying to complete a python tutorial that shows how to make custom tools. I run the code below and it still produces an error message stating that "cur" is not defined. I've experimented with the indentation, but still doesn't seem to run. It appears that the problem is after "finally", the 'del cur' statement keeps the script from executing right. import arcpy, os
try:
outputFC = arcpy.GetParametersAsText(0)
fClassTemaplate = arcpy.GetParametersAsText(1)
f = open(arcpy.GetParameterAsText(2),'r')
arcpy.CreateFeatureclass_management(os.path.split(outputFC)[0], os.path.split(outputFC[1]), "point", fClassTemplate)
lstFires = f.readlines()
cur = arcpy.InsertCursor(outputFC)
cntr = 1
for fire in lstFires:
if 'Latitude' in fire:
continue
vals = fire.split(",")
latitude = float(vals[0])
longitude = float(vals[1])
confid = int(vals[2])
pnt = arcpy.Point(longitude, latitude)
feat = cur.newRow()
feat.shape = pnt
feat.setValue("CONFIDENCEVALUE", confid)
cur.insertRow(feat)
arcpy.AddMessage("Record number" + str(cntr) + "written to feature class")
cntr = cntr + 1
except:
print arcpy.GetMessages()
finally:
del cur
f.close()
... View more
05-20-2013
07:26 PM
|
0
|
1
|
261
|
POST
|
Writing the script in IDLE first and then loading it was a great idea. Made it much easier to troubleshoot. Turned out the Streams layer wasn't valid for whatever reason, but the error message in the Arcpy window wasn't letting me know it. Thanks for the idea, will load all future scripts through idle for just this reason.
... View more
05-17-2013
07:28 PM
|
0
|
0
|
385
|
POST
|
Have both the streams and schools layers in my active arcmap session. I am using arcmap's Python window to run this script in a python tutorial that finds schools within a specified distance from streams. Here's the code, error is on line 9: import arcpy >>> arcpy.env.workspace = "c:/GIS/Python/data/TravisCounty" >>> try: ... streams = "Streams.shp" ... streamBuffer = "StreamsBuffer.shp" ... distance = "2640 Feet" ... schools2mile = "Schools.shp" ... arcpy.Buffer_analysis(streams,streamBuffer,distance,'FULL','ROUND','ALL') ... arcpy.MakeFeatureLayer_management(schools2mile,'Schools2Mile_lyr') ... arcpy.SelectLayerByLocation_management('Schools2Mile_lyr','intersect',streamBuffer) ... except: ... print 'Error' ... Parsing error SyntaxError: invalid syntax (line 9)
... View more
05-17-2013
04:54 AM
|
0
|
3
|
684
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|