|
POST
|
At a quick glance, you're looping through your SearchCursor, and within that SearchCursor you're looping through the UpdateCursor. So each time through the Search loop, you're updating all your data with the same set of data, the one row, of search results. If three loops through your SearchCursor returned a, b, c, respectively, your UpdateCursor then populates your field with all a's, then all b's, then all c's, respectively.
... View more
06-20-2014
05:30 AM
|
0
|
0
|
1610
|
|
POST
|
Technically, whenever you add a shapefile or feature class to a mxd, Arc actually makes a layer file out of it. Things like symbology, definition queries, etc., aren't stored with the actual data. I didn't know this until I talked with an ESRI instructor at a class, because it's not well documented. This is why Python scripts sometimes have to make a layer feature first.
... View more
06-18-2014
04:56 PM
|
0
|
0
|
4186
|
|
POST
|
Another option is to save it a a layer (.lyr) file. Right click the layer in the table of contents, select Save as layer file, and save it where you want. This will preserve symbology. You can then add the layer file just like a shapefile, or use it for importing symbology as Ian suggests.
... View more
06-18-2014
04:48 PM
|
0
|
0
|
4186
|
|
POST
|
Maybe null (None in Python) values in your Value field? Try changing the if statement to: if newValue is not None and newValue > 0: return...etcAnother possibility: is Value a text field?These don't seem like syntax errors to me, but worth a shot. Maybe also check if Value is the real field name, and not an alias. Again not an expected error, but hey...
... View more
06-18-2014
04:40 PM
|
0
|
0
|
1336
|
|
POST
|
Is the county in a shapefile? If the files are in the same format, you could use Append, or copy/paste.
... View more
06-18-2014
08:53 AM
|
0
|
0
|
848
|
|
POST
|
Couple notes: make sure the parser is set to Python (VBScript is the default), and Reclass isn't a good function name, because there's already a Reclass tool for rasters. Not saying it won't work, but at best it's confusing. Anyway, you have to include the field(s) you use in the argument list. def myUpdate(hygrp, sqmile):
# using upper() in case value is lower case a
if hygrp.upper()== 'A': return sqmile
myUpdate(!Updat_HYGRP!, !Sq_Miles!) Another alternative is to just select by attribute features where Updat_HYGRP = 'A', then calculate those values to Sq_Miles. The Field Calculator will only calculate the selected records.
... View more
06-18-2014
05:02 AM
|
0
|
0
|
721
|
|
POST
|
No, they don't appear in Customize -> Commands. You have to select the Categories listed above in the Commands tab. For example, click Topology in the left pane (Categories), and Align to Edge should be in the right pane. Drag it to a toolbar, doesn't matter which one. If you click Topology (or Advanced Editing for Align to Shape), and the tool isn't there, I'd contact ESRI. I'm not sure what license level they're at, possibly that's an issue.
... View more
06-17-2014
08:51 AM
|
0
|
0
|
2563
|
|
POST
|
Might help to post the problem code section. As a guess, are you checking for None values before executing the code? Another option might be to not alias arcpy.utils, and call it as arcpy.utils. No idea why that would be an error, but worth a shot.
... View more
06-16-2014
01:42 PM
|
0
|
0
|
3160
|
|
POST
|
There are Find Identical and Delete Identical tools in ArcToolbox under Data Management.
... View more
06-16-2014
04:25 AM
|
0
|
0
|
575
|
|
POST
|
Esther, Sorry if this is too late for your deadline, had a busy weekend. I've tried several variations of the script below, which as far as I can see should work, but also getting the can't open error. I'm starting to think it's a problem because (at home) I'm on 10.2, but the data was created in 10.2.1 or 10.2.2, except I see it fine in ArcCatalog. Can't export it, though, so no help there. What version of Arc are you using? Another possibility is that the gdb or data got corrupted somehow. Can you get a fresh copy? You did a good job setting it up as a tool, so kudos there. edit: oh, also, wouldn't use 'Expression' with an upper case e, since that comes up as an existing word in intellisense. import arcpy
fc = r"C:\Test\OlsonMurphyWeek10\SouthFloridaNaturalGas.gdb\Mains"
classField = "Material"
fields = ["Material", "Diameter", "System"]
expression = arcpy.AddFieldDelimiters(fc, classField) + " = 'Plastic'"
#Define output
##outReport = arcpy.GetParameterAsText(1)
outReport = r"C:\Test\Esther.txt"
#Open the report text file in write mode
with open(outReport, "w") as rptFile:
#Add Header lines to report text file
rptFile.write("Mains found in this report include:\n")
rptFile.write(expression + "\n")
print fc
print fields
print expression
# Create cursor to search gas mains by material
with arcpy.da.SearchCursor(fc, fields, expression) as cursor:
for row in cursor:
rptMat = str(row.getValue("Material"))
rptDiam = str(row.getValue("Diameter"))
rptSys = str(row.getValue("System"))
rptFile.write(rptMat + " " + rptDiam + " " + rptSys + "\n")
print "Done!"
... View more
06-15-2014
02:24 PM
|
0
|
0
|
1345
|
|
POST
|
How about you post your code and data (or a sample), and I'll try to look at it this weekend. Its Fathers day weekend, so can't promise your Sunday deadline, but will try if possible.
... View more
06-13-2014
05:56 PM
|
0
|
0
|
1345
|
|
POST
|
Ian fixed it, but also notice that when you set the SearchCursor, you forgot the with keyword. Not sure why you set Field twice, but no harm done. Except you have the last quotation mark outside the closing list bracket.
... View more
06-13-2014
12:18 PM
|
0
|
0
|
1345
|
|
POST
|
Try printing Qry right after you set it to make sure it has the value you want. Maybe print other values as well. For Get ParameterByText to work, you need to have made the script a tool, or run it from the command line with arguments. I recommend hard coding some values in for testing. Once it works there, you can switch to parameters.
... View more
06-13-2014
11:08 AM
|
0
|
0
|
1705
|
| Title | Kudos | Posted |
|---|---|---|
| 6 | 08-22-2019 07:41 AM | |
| 1 | 05-05-2014 04:30 AM | |
| 1 | 08-15-2018 06:23 AM | |
| 3 | 08-06-2018 07:31 AM | |
| 1 | 03-30-2012 08:38 AM |
| Online Status |
Offline
|
| Date Last Visited |
12-12-2021
01:00 PM
|