|
POST
|
This will only work is if the ObjectId value identifying each cell is identical across all tables, or there is some other common ID value field the preserves a common CELL ID across all 42 of your GRID tables. If the ObjectID is the only field that uniquely identifies each cell, then it must first be calculated into a Long field that will make its value permanent when you merge the tables. If the ObjectIDs are randomly assigned to any given cell across the tables, they you would first have to come up with a spatial method to assign each cell a specific unique value that is stable across all years and contained in every GRID table to perform any kind of summary by cell. So first create a LONG field called CELL in every table and calculate the ObjectID of every table into it. Then merge all of the tables into one table. Then use the Summary Statistics tool and use the CELL field as the Unique Case field and each month field as a Summary field with the Mean summary type. All 78,000 cells will have their average created when the CELL field collapses to a single row for each CELL value with 12 columns of Means of the months of the year. This output summary table can then be joined back to the original 42 tables on the CELL field to compare each cell's actual annual month value to the corresponding 42 year mean (average) month column, if you wish to do that.
... View more
12-26-2014
06:53 PM
|
0
|
1
|
2836
|
|
POST
|
My instructions would give you the 42 year average by Month if this table has 42 rows (i.e., One row with 12 month column each giving the mean/average value of water for each month. Otherwise what field defines the Cell? If there is a field that has cell ID values then make that the Case Field in the Summary Statistics tool. But then how do you you know which year is which in this table? Are you sure you have correctly described what data this table contains? Beyond the month names none of the other column names mean anything without an explanation. No matter what, the Summary Statistics tool is the tool that does what you are after since this is not a spatial feature class, just a table. If this was a Feature Class then the Dissolve tool would be better to do the summaries spatially.
... View more
12-26-2014
03:30 PM
|
0
|
3
|
2836
|
|
POST
|
Use the Summary Statistics tool in the Analysis Toolbox -> Statistics toolset without any case field and add each month to the summary field list and use the Mean option. Optionally you can add each month multiple times to get the Min, Max, and Std Dev as well at the same time using this tool.
... View more
12-26-2014
02:06 PM
|
0
|
5
|
2836
|
|
POST
|
It cannot be done with standard layer symbology. There is no equivalent to label classes, which can apply multiple scale dependent settings to labels in a single layer, that applies to standard layer symbology. The Labels tab has a "Scale Ranges..." button, which is required to set up that behavior, but the Symbology tab does not have any button like that. Scale ranges only affect standard layer symbology by making it visible or invisible, not by altering any layer symbology settings. You must create separate layers with separate scale ranges and symbology styles to do this with standard layer symbology, which most people manage in a group layer. Representations possibly can do this, but I have never tried setting that up myself. After looking at the help though it appears that even repesentations rely on different layers to control multiple scales, at the very least no help topic clearly explained how more than one representation rule based on scale range could be applied to a feature within a representation. In fact, although it is a bit vague and unclear, it seems to suggest that multiple scale range control of representations may also possibly involve multiple layers of feature classes in this help topic: Do you need to use this dataset at multiple scales? How will the representations change at each map scale? You may find that you'll need alternative feature class representations for use at other scale ranges. In these cases, you can consider additional feature classes for representing the same data theme for each scale range. I do not believe that "alternative feature class representations for use at other scale ranges" can be applied within a single layer any more than multiple standard layer symbology configurations based on scale can be applied to a layer You must adapt your requirements to fit the way the software works. Sorry. In general, Esri favors designing simple, limited rules for layers and geoprocessing operations that requires a user to generate a new layer or geoprocessing output any time they want to go beyond those rules, rather than designing complex, sophisticated rules that can make a single layer or geoprocessing operation serve a wider range of behaviors.
... View more
12-26-2014
06:56 AM
|
1
|
0
|
1027
|
|
POST
|
Calc Val is a string and expression is a string variable, but the string must be quoted twice, once for the actual value in the field calucator, and another time for the string variable. So expression = "Calc Val" won't work, but expression = "'Calc Val'" should work (single quotes inside double quotes work for Python calculations, but not VB Script calculations. For VB Script it would be expression = """Calc Val""").
... View more
12-25-2014
06:49 AM
|
0
|
2
|
2195
|
|
POST
|
I have used this tool repeatedly with 10.2 and never seen that error. So it is definitely not the version causing the problem. What kind of table is the event table? I never recommend using Excel for anything in ArcMap if that is what you are using. I always convert Excel tables to File geodatabase tables. Can you screen shot your set up screen for the tool? How did you assign the tool parameters? Did you browse for the event source? Are the route source and event source in your map or being access from disk? Is this behavior occurring as part of a model or script or just from running the tool directly manually? Do you have full access rights to the output workspace? Are there spaces or special characters in the folder or file names? Sounds like an error creating the output table. Is that correct?
... View more
12-24-2014
07:57 AM
|
1
|
0
|
1040
|
|
POST
|
I would think that to select one of each Category all at once in the layer you would want the code to be like this: import arcpy
"""Get the current map layers."""
mxd = arcpy.mapping.MapDocument("CURRENT")
lyrName = "line"
"""Find the layer name"""
lyr = arcpy.mapping.ListLayers(mxd, lyrName)[0]
dict = {}
with arcpy.da.SearchCursor(fc, ["Category", "OID@"]) as cursor:
for row in cursor:
keyValue = row[0]
if not keyValue in valueDict:
dict[keyValue] = row[1]
del cursor
#perform selection based on one ObjecctID value from each Category
whereClause = "OBJECTID IN ("
for key in dict:
if whereClause == "OBJECTID IN (":
whereClause = whereClause + str(dict(key))
else:
whereClause = whereClause + ", " + str(dict(key))
whereClause = whereClause + ")"
arcpy.SelectLayerByAttribute_management(lyrName, "NEW_SELECTION", whereClause)
print 'finished'
... View more
12-23-2014
11:15 AM
|
0
|
0
|
2134
|
|
POST
|
Try the code now. I was trying to write it without testing, but now I have tested it on my own data. 131652 records summarized based on 16040 unique ID categories were processed in 1 minute 8 seconds.
... View more
12-23-2014
10:15 AM
|
1
|
0
|
3460
|
|
POST
|
An Insert cursor would probably be the best for creating a new feature class and would finish in less than 2 minutes most likely. I would not do this, unless you create a unique key for each point that is not the ObjectID, since without that you have no way to reliably relate the new feature class to the old. So I won't do this based on what you have shown. Select by Attribute, especially using the Add to Selection option is time consuming, but it was necessary if I was to do what you originally asked and not alter the schema of the table. The only way to avoid days of processing is to create a new flag field indicating if the record was in the Top 20% or not and use an update cursor to populate it. Then you could use a simple SQL selection on that field. That could complete in under 3 minutes. I will assume that is what you will do, since it is the easiest for me to recode and the most flexible for exporting and processing.
... View more
12-23-2014
08:08 AM
|
1
|
3
|
3460
|
|
POST
|
If you want to select the top 20% of the highest values this code should work: import arcpy
"""Customize the layer name, IDField and valueField"""
lyrName = "sourceLayer"
IDField = "RID"
valueField = "MEAS"
Top20Field = "TOP20PERCENT"
"""Get the current map layers."""
mxd = arcpy.mapping.MapDocument("CURRENT")
"""Find the layer name"""
lyr = arcpy.mapping.ListLayers(mxd, lyrName)[0]
"""Create a dictionary of keys, values and record counts"""
valueDict = {}
with arcpy.da.SearchCursor(lyr, [IDField, valueField, "OID@"]) as searchRows:
for searchRow in searchRows:
keyValue = searchRow[0]
if not keyValue in valueDict:
valueDict[keyValue] = [[(searchRow[1],searchRow[2])], 1]
else:
valueDict[keyValue][0].append((searchRow[1], searchRow[2]))
valueDict[keyValue][1] += 1
print "Dictionary Read"
"""Create an OID List of records that are in the Top 20%"""
OIDList = []
for keyValue in sorted(valueDict.keys()):
valueDict[keyValue][0] = sorted(valueDict[keyValue][0], reverse=True)
top20Percent = int(round(valueDict[keyValue][1] * .2, 0))
for n in range(0, top20Percent):
OIDList.append(valueDict[keyValue][0] [1])
"""Write a flag value to the Top20Field to indicate whether or not each record is in the Top 20%"""
with arcpy.da.UpdateCursor(lyr,["OID@", Top20Field]) as updateRows:
for updateRow in updateRows:
if updateRow[0] in OIDList:
updateRow[1] = "Yes"
else:
updateRow[1] = "No"
updateRows.updateRow(updateRow)
If you want the top 20% with the lowest values change line 30 to valueDict[keyValue][0] = sorted(valueDict[keyValue][0])
... View more
12-22-2014
03:22 PM
|
1
|
5
|
3460
|
|
POST
|
The code has been written to work as an Advanced Label Expression, not as a field calculation. For a field calculation I would write it like: Parser: VB Script Use Codeblock: Checked Pre-Logic Codeblock: Output = [NAME]
dblQoute = instr(Output, chr(34))
if dblQuote > 0 Then Output = Left(Output, dblQuote - 1) & " inch" NAME= Output
... View more
12-18-2014
09:27 AM
|
2
|
0
|
2526
|
|
POST
|
Caught that and fixed it in my post just before I saw your reply. Retry the code.
... View more
12-18-2014
08:34 AM
|
0
|
3
|
2526
|
|
POST
|
You should have included that detail in your description of what you were trying to do, since dropping text is a completely different issue. So Try: Function FindLabel ( [NAME] ) If Not IsNull([NAME]) Then NewStr = [Name] If Instr(NewStr, chr(34)) > 0 Then NewStr = Left(NewStr, Instr(NewStr, chr(34))) End If NewStr = Replace(NewStr, chr(34), " inch") FindLabel = NewStr End If End Function
... View more
12-18-2014
08:11 AM
|
1
|
4
|
4271
|
|
POST
|
To make all quotes turn into " inch" your VB Script label code should be: Function FindLabel ( [NAME] ) If Not IsNull([NAME]) Then NewStr = Replace([NAME], "''"", " inch") FindLabel = NewStr End If End Function This assumes no quote character in your data is a real quote character and always changes to inch. If that is true, you should not have to deal with the full field value in your features, just the quote character.
... View more
12-18-2014
07:39 AM
|
0
|
0
|
2526
|
|
POST
|
Well I misread your earlier post. !Shape@Area! and !Shape@Length! are the area and perimeter values of the feature in its native units. So is this just a simple unit conversion problem? If so, once you know the native units of the feature you can get the conversion factors from here and apply them to the row[2] and row[3] values to get square meters and meters. Or you could provide a Spatial Reference that used meters as the cursor's fourth parameter and then the !Shape@Area! and !Shape@Length! would return values in square meters and meters. If you are trying to independently calculate area and confirm the values against those of the area and length returned by the shape method, than the euclidean distance method I gave will be one method for doing that for the perimeter length, provided the distances are not covering a large portion of the globe's surface. For area calculations I don't know an independent formula that will work for all possible polygon shapes (which in part accounts for why we buy Esri's product to take advantage of people who have figured that out). Using the !Shape@Area! values, or the getArea values from a geometry would be the approaches I would take.
... View more
12-14-2014
11:52 AM
|
0
|
0
|
4237
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 03-24-2026 11:37 PM | |
| 1 | 03-24-2026 08:01 PM | |
| 7 | 02-23-2026 08:34 AM | |
| 1 | 03-31-2025 03:25 PM | |
| 1 | 03-28-2025 06:54 PM |
| Online Status |
Offline
|
| Date Last Visited |
07-09-2026
12:59 AM
|