|
POST
|
I'm not sure, that looks correct to me. The line says, "Find the value in the current row, in the field specified in the 2nd variable listed in the cursor (the labelField), split it when there is a hyphen, return the portion before the first hyphen (or the entire string if there is no hyphen), convert it to a string, and store the value in a variable called twp". Have you changed the labelField to match your field name? Also, check the previous line to make sure it's correct (e.g. not missing the colon).
... View more
06-24-2015
11:37 AM
|
0
|
2
|
3050
|
|
POST
|
Just a note that Tabulate Area is a better choice for categorical area analysis because: a.) it calculates area directly. Zonal Statistics will provide a sum of cells that you will have to calculate to an area later. b.) it will handle more than one class. Zonal Statistics provides one final statistic per zone (sum, mean, etc.) so unless you are only interested in summing the number of cells with the value 1, this is not a good tool to use. Tabulate Area will provide sums for each class, regardless of it's original value.
... View more
06-24-2015
10:25 AM
|
2
|
1
|
2915
|
|
POST
|
Tabulate Area will give you the areas of 0 and 1 inside your shapefile. You will have to define what is "outside". If it's your whole raster, just calculate the total areas of 0 and 1 and subtract those inside. If some other area for "outside", draw a polygon and use Tabulate Area.
... View more
06-24-2015
10:14 AM
|
2
|
37
|
2915
|
|
POST
|
Could you post the entire error message? What is an example of an invalid character? Is it always the same character that you could simply replace or ignore? You might try Copy Features rather than Feature Class to Feature Class, as well.
... View more
06-24-2015
09:16 AM
|
1
|
10
|
6646
|
|
POST
|
This ended up being more complicated than I expected, but here's what I got. I have doubt there's a more direct route. Also, there be some hidden gotchas in your data. It updates a field called "ord", based on labels in "rnd" (in format "102-65NE"), from a feature class "points": >>> from operator import itemgetter # import itergetter function
... myList = [] # make empty list
... fc = "points"
... labelField = "rnd"
... orderField = "ord"
... with arcpy.da.SearchCursor(fc,["OID@",labelField]) as cursor: # loop through your feature class
... for row in cursor:
... twp = str(row[1].split("-")[0]) # get township
... if len(row[1].split("-")) > 1: # if there is more than just TWP
... sec = ""
... qtr = ""
... for x in row[1].split("-")[1]: # loop through characters after hyphen
... if x.isdigit():
... sec += str(x) # add to section if numerical
... else:
... qtr += str(x) # add to quarter if letter
... if len(qtr) == 0:
... qtr = 0
... else:
... sec = 0
... print twp
... myList.append({"OID":row[0],"TWP":int(twp),"SEC":int(sec),"QTR":qtr}) # add to list
... myList = sorted(myList, key=itemgetter("TWP","SEC","QTR")) # sort list in place, by TWP, SEC, QTR
... with arcpy.da.UpdateCursor(fc,["OID@",orderField]) as cursor: # start updating
... for row in cursor:
... row[1] = next(index for (index, d) in enumerate(myList) if d["OID"] == row[0]) # enumerate list and match OIDs
... cursor.updateRow(row) # update row to include a number
... View more
06-23-2015
03:11 PM
|
1
|
4
|
3050
|
|
POST
|
Yes, that helps. Do you have a quarter section grid? If so, it would be a matter of 1.) Create one field to store map type in your index layer 2.) Assign values of "TWP", "SEC", or "QTR" to denote whether the page is a township, section or quarter section map. You can likely do this automatically based on the index feature size (township > section > quarter). 3.) Spatial Join (must use the geoprocessing tool, not right-click join dialog) the index layer to the quarter section grid, based on HAVE_THEIR_CENTERS_IN. Now index features will have quarter info. 4.) Using if...then logic in field calculator, calculate the page number (if map type = "QTR", make a page number like "TWP" + "-" + "SEC" + "QTR") Once you have your page numbers in a field, you must determine their order, which will be my next post.
... View more
06-23-2015
02:06 PM
|
1
|
5
|
3050
|
|
POST
|
I'm a little confused what step you're at. Do you need to assign the page numbers based on whether or not it's a detail map, or create a sortable field to order your exported data driven pages based on the page number, or both?
... View more
06-23-2015
01:39 PM
|
0
|
7
|
3050
|
|
POST
|
By setting a global variable, you can keep track of which click you're on: var count = 0; Increment each time the button is clicked (in your execute function): count++; Get the proper result (in showResults function): var featureAttributes = results.features[count].attributes; Finally, reset the counter when the id changes: count = 0; JS Bin - Collaborative JavaScript Debugging
... View more
06-23-2015
01:06 PM
|
2
|
1
|
2893
|
|
POST
|
This is a very broad question. Not trying to be too snarky, but I assume it would be similar to asking you, "Is there a manual for computer science?" Your best resource will be the help, probably the Geodata section or What is a Layer?. For more JS API-geared help, try here (especially the esri/layers section).
... View more
06-23-2015
11:21 AM
|
0
|
2
|
1843
|
|
POST
|
From your code, there's no guarantee that you've correctly assigned fld_caseID and fld_caseID2
... View more
06-23-2015
10:43 AM
|
0
|
7
|
4268
|
|
POST
|
As Robert mostly says, you would use: results.features.attributes.ATTACHLOC where i indicates which object to return. Using a global variable, you can track whether i should be 0 or 1. edit: to get each attribute value, one at a time: var featureAttributes = results.features.attributes;
for (var key in featureAttributes) {
console.log(featureAttributes[key]);
}
... View more
06-23-2015
10:04 AM
|
2
|
0
|
2893
|
|
POST
|
Make sure your data is projected. The following Python script will copy features from a layer ("polys"), the number of times specified in "numCopies", separated by the distance "distBtw" (in the layer's linear unit) ^ the script uses the distance unit taken from the spatial reference. Once your coordinate system is defined, it should work.
... View more
06-22-2015
02:28 PM
|
1
|
3
|
1411
|
|
POST
|
Make sure the new value you are trying to use is the same as, or compatible with, the field you are updating. ArcGIS doesn't know how to change "12:03:46:23" to a float value.
... View more
06-22-2015
11:19 AM
|
1
|
0
|
3613
|
|
POST
|
Your field "Total_Time" is Float, but you are trying to force in the String returned from your function. Change the data type to either String or Date, and make sure that's what your function returns.
... View more
06-22-2015
11:12 AM
|
0
|
6
|
3613
|
| 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
|