|
POST
|
What does your print message before that say you are processing? print " Processing File: " + os.path.join(workspace, fc)
arcpy.AddMessage(" Processing File: " + os.path.join(workspace, fc)) Is it always on the second loop or does it vary?
... View more
07-23-2013
07:08 AM
|
0
|
0
|
1688
|
|
POST
|
Add these lines before your select by location, change your select by location to the new feature layer. Public_Seed_Grounds_lyr = "Public_Seed_Grounds_lyr" arcpy.MakeFeatureLayer_management(Public_Seed_Grounds_shp, Public_Seed_Grounds_lyr, "\"SEEDGRND\" = 'Lake Felicity'") arcpy.SelectLayerByLocation_management(VMS_InsideSDG, "INTERSECT", Public_Seed_Grounds_lyr, "1 Miles", "NEW_SELECTION")
... View more
07-23-2013
06:43 AM
|
0
|
0
|
1508
|
|
POST
|
What version of python are you using? 2.7 should be able to open xlsx files fine. Edit: xlrd 0.8.0+ support xlsx. If you are asking about writing to xlsx you'd need to find another module currently. openpyxl seems preferred.
... View more
07-18-2013
11:11 AM
|
0
|
0
|
5915
|
|
POST
|
Can you post your code you are running again? The only lines you should need are these import arcpy workspace = "Database Connections\\CCENTGIS_SCLFinal_PRSCL_test.sde\\prscl_test.SCLADMIN.GMSCL" fc = "prscl_test.SCLADMIN.sclarc" arcpy.env.workspace = workspace arcpy.MakeFeatureLayer_management(fc, "sclarc_layer") with arcpy.da.Editor(workspace) as edit: arcpy.CalculateField_management("sclarc_layer", "STRNAME", "!strname!.strip", "PYTHON_9.3", "")
... View more
07-18-2013
10:14 AM
|
0
|
0
|
3400
|
|
POST
|
Have you tried removing those lines completely? The help examples shows just the with statement as able to stop and close the edit session automatically. http://resources.arcgis.com/en/help/main/10.1/index.html#//018w00000005000000 with arcpy.da.Editor(workspace) as edit:
arcpy.CalculateField_management(
layer_name, 'Usage', '"PUBLIC"', 'PYTHON')
... View more
07-18-2013
08:21 AM
|
0
|
0
|
3400
|
|
POST
|
Ah yes you'll have to have those inside your with statement as afterwards your edit variable is closed automatically.
... View more
07-18-2013
07:22 AM
|
0
|
0
|
3400
|
|
POST
|
Are you connected with a version user that can make edits?
... View more
07-17-2013
02:06 PM
|
0
|
0
|
3400
|
|
POST
|
I believe you need to set your workspace to your feature dataset, not the general database.
... View more
07-17-2013
12:54 PM
|
0
|
0
|
3399
|
|
POST
|
Check out the positionAlongLine property of the polyline geometry object. You can use it by combining a search cursor on your line features to get the geometry and an insert cursor on your point features to write the points to. resources.arcgis.com/en/help/main/10.1/index.html#/Polyline/018z00000008000000
... View more
07-17-2013
11:20 AM
|
0
|
0
|
615
|
|
POST
|
This line just takes the first row of the cursor without having to go through getting a row object. The cursor itself is a generator, which needs to be converted to a tuple to get the row values. The first [0] index is the first row, of which there should only be one anyway, the next [0] index is the first attribute, again of which there is only one, the FIPS_TXT field. countycode = tuple(arcpy.da.SearchCursor("Countieslayer", "FIPS_TXT"))[0][0]
... View more
07-17-2013
06:56 AM
|
0
|
0
|
1834
|
|
POST
|
This could be one way of doing it. countycode = tuple(arcpy.da.SearchCursor("Countieslayer", "FIPS_TXT"))[0][0] urows = arcpy.da.UpdateCursor("Stewardship", "County") for urow in urows: urow[0] = countycode urows.updateRow(urow)
... View more
07-16-2013
02:26 PM
|
0
|
0
|
1834
|
|
POST
|
There are better ways to accomplish what you are trying to do but you have the gist of it. Why do you have your obj_id counter? It doesn't seem to be used for anything in your code. For your two datasets "Countieslayer" and "Stewardship" do these both have just one row in them?
... View more
07-16-2013
01:59 PM
|
0
|
0
|
1834
|
|
POST
|
First off, you are overwriting your cursor in the middle of iterating through it as well as your row objects, this will cause all sorts of problems. Additionally, your indentation is a little inconsistent, and creating a cursor for every row in another cursor is terribly inefficient.
... View more
07-16-2013
01:08 PM
|
0
|
0
|
1834
|
|
POST
|
Weird, if I calculate my "other" field equal to OBJECTID, it won't honor that now either. Set it back to sequential numbers and it works. However, the makefeaturelayer never seems to report the same number of features that the same select query, on the same dataset in ArcMap. Makefeature either seems to ignore my query and returns all results (as if I use OBJECTID) or, will return fewer results than actually match the query. (Finds 129 where "rec" <= 150 after sequentially calculating the rec field from 1 to 2110) Exact same "select by attributes" in ArcMap returns the 150 that actually match the query. R_ Well that's even weirder.
... View more
07-16-2013
10:49 AM
|
0
|
0
|
1341
|
|
POST
|
do you only have 99 features in that fc? I can't seem to get the where clause to take on my FC, it always returns all records in the data. It seems to work if I put my where clause on a different field, but can't get it to honor a where clause on OBJECTID ????? R_ No, I have almost 3000 features in the FC.
... View more
07-16-2013
10:40 AM
|
0
|
0
|
1341
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 05-17-2011 10:36 AM | |
| 1 | 08-16-2012 10:48 AM | |
| 1 | 10-31-2012 08:39 AM | |
| 1 | 07-16-2012 01:52 PM | |
| 1 | 03-15-2012 10:57 AM |
| Online Status |
Offline
|
| Date Last Visited |
08-22-2024
11:12 PM
|