POST
|
Tried it, but it should have already been deleted from the delete statement near the end of the script. Again, thank you for your input. I'm thinking this is a problem with something stored in memory, or with a workspace or something. I just have an utter lack of experience with handling something like that.
... View more
05-29-2014
02:47 PM
|
0
|
0
|
1963
|
POST
|
Adding the extra set of quotation marks made it crash on the first run through. The code does actually select OBJECTID = 1 the first time and performs the subsequent steps correctly. It is merely a problem of not accepting the input parameters for the make feature layer on subsequent iterations. Thank you for the feedback though
... View more
05-29-2014
02:34 PM
|
0
|
0
|
1963
|
POST
|
I've ran into a bit of a unique problem, which for the life of me I cannot get debugged. I have a two geodatabase feature classes, one with customer regions, and one with zip codes. I'm iterating through each region and selecting each zip code within and writing the region with zip codes to a csv. This works flawlessly the first loop through, but I run into an error on the Make Featuer Layer on subsequent iterations. I am entering in the code through the iterative python window, and both fcs are in the TOC, and neither Feature Layer exists prior to running the code. import arcpy from arcpy import env env.overwriteOutput = 1 arcpy.env.overwriteOutput = True #env.workspace = r"C:\Users\iamurray\Desktop\Ray\Zip Code\ZipCodes.gdb" output = open(r"C:\Users\iamurray\Desktop\Output.csv", "w") count = 1 for item in range(1,163,1): # there are 162 features to be selected, input1 = "TVA_Distributors" input2 = "TVA_PSA_Zips" outlayer1 = "TVA_Distributors_Layer" outlayer2 = "TVA_PSA_Zips_Layer" print count #arcpy.SelectLayerByAttribute_management(input1, "NEW_SELECTION", [OBJECTID] = + str(count)) arcpy.MakeFeatureLayer_management(input1, outlayer1, 'OBJECTID = ' + str(count)) #works on count = 1 but not on count = 2 and subsequent cursor = arcpy.da.SearchCursor(outlayer1, ["DISTRIBU_1"]) for row in cursor: output.write(str(row[0])+ "\n") print row[0] del cursor # Process: Select Layer By Location arcpy.SelectLayerByLocation_management(input2, "INTERSECT", outlayer1, "", "NEW_SELECTION") # Process: Make Feature Layer (2) arcpy.MakeFeatureLayer_management(input2, outlayer2) field = "ZIP" cursor = arcpy.SearchCursor(outlayer2) for row in cursor: output.write(str(row.getValue(field))+ "\n") count += 1 print "The Current number of Distributors Processed is " + str(count - 1) arcpy.Delete_management(outlayer1) arcpy.Delete_management(outlayer2) del row del cursor output.close() These are the results I am getting 1 Warren RECC The Current number of Distributors Processed is 1 2 Runtime error Traceback (most recent call last): File "<string>", line 20, in <module> File "c:\program files (x86)\arcgis\desktop10.1\arcpy\arcpy\management.py", line 5748, in MakeFeatureLayer raise e ExecuteError: ERROR 000622: Failed to execute (Make Feature Layer). Parameters are not valid. ERROR 000628: Cannot set input into parameter in_features. It works fine the first time, because it reaches the print count on the second run through successfully. At first I thought it was an issue with the overwrite, but I've set both of those to allow overwrite and deleted the intermediate layers prior to the next MakeFeatureLayer. The input and outputs should not change just the expression, which should still be valid each time, since each has a unique OBJECTID number. I simply can't see what is wrong with the tool parameters that would cause this to crash on the subsequent loops. If anyone has some insight into this, I would be most appreciative, I'm using ArcGIS 10.1 SP1. EDIT: There are no syntax errors if you find any, its a result of me copying the code over.
... View more
05-29-2014
02:06 PM
|
0
|
11
|
7200
|
POST
|
looking at your code lyrlist = arcpy.mapping.ListLayers(mxd) should be lyrlist = arcpy.mapping.ListLayers(map) you never create a variable called mxd, you'd probably need to substitute it with your local variable map, as it refer to the map in your list of map files.
... View more
05-22-2014
12:15 PM
|
0
|
0
|
265
|
POST
|
I had never tried it for that purpose, but I was hoping. If you have a spatial analyst extension, perhaps do a raster to point conversion, then interpolate the points using a method that would keep the values from the known points such as spline and select the same cell size as the initial raster? I'm open to other input if anyone has any.
... View more
05-22-2014
12:02 PM
|
0
|
0
|
398
|
POST
|
Have you tried the resample datamanagement tool? http://resources.arcgis.com/en/help/main/10.1/index.html#//00170000009t000000
... View more
05-22-2014
07:06 AM
|
0
|
0
|
398
|
POST
|
You'll probably need to use cursors to iterate over each row check the values of your fields and update the value of the field you are calculating. Depending on how many species code fields, it could be rather lengthy code. Hopefully this gets you pointed in the right direction. http://resources.arcgis.com/en/help/main/10.1/index.html#//018z0000009r000000 http://resources.arcgis.com/en/help/main/10.1/index.html#//002z0000001q000000 These are the 10.1 Help, it should be relatively easy to find it for 10.0 on your computer using the arcgis help.
... View more
05-21-2014
11:06 AM
|
0
|
0
|
540
|
POST
|
You can just put the lat/long values in an excel spreadsheet or a csv file for your table. Just make sure the first row has the headers for the fields. Example Lat Long 35.823323 -85.326473
... View more
05-21-2014
05:34 AM
|
0
|
0
|
791
|
POST
|
Hi Gino, Since you are using python on this, if you would post your code it would definitely be helpful in trying to find a solution to your problem. Also you say you have a list of properties that you are trying to do this for, are they all seperate files, or individual records in a single attribute table?
... View more
05-21-2014
04:24 AM
|
0
|
0
|
1172
|
POST
|
Yours worked, it just wasn't quite stylistically what they wanted I suppose. Go home and have a good night!
... View more
05-16-2014
02:33 PM
|
0
|
0
|
1153
|
POST
|
Yeah, I agree splitting the text in half like that is not really nice, but the OP said that it didn't matter so I didn't make it more complicated. Plus I'm racing against you to figure it out. lol 🙂 Plus I have to leave work now... Haha, pretty much the same here. From the two examples that were given I figured she wanted them to be split by the city names so thats what I went for. Nothing wrong with yours, just a stylistic difference 😉 Edit: Dang, she marked her quote of my response as answer, no answer provided for me 😞 😛
... View more
05-16-2014
02:26 PM
|
1
|
0
|
1153
|
POST
|
def FindLabel ( [Name] ):
Split = [Name].split(",")
Split = Split[0] #drops everything after comma
Split = Split.split("-") #splits by the hyphen
if len(Split) == 2:
expression = Split[0] + "- \n" + Split[1]
return expression
elif len(Split) == 3:
expression = Split[0] + "-" + Split[1] + "- \n" + Split[2]
return expression
else:
return Split[0]
Likewise mine labelled all the samples. It will only work if there are 3 or less cities names in the name field. I like yours Sol, except it splits single names in half, I think those ones would be fine on one line, but I guess its not my call. [ATTACH=CONFIG]33885[/ATTACH]
... View more
05-16-2014
02:17 PM
|
1
|
0
|
1153
|
POST
|
from your reply, you didn't use my most recent script, or at least you didn't post it back.
def FindLabel ( [Name] ):
Split = [Name].split(",")
Split = Split[0] #drops everything after comma
Split = Split.split("-") #splits by the hyphen
if len(Split) == 2:
expression = Split[0] + "- \n" + Split[1]
return expression
elif len(Split) == 3:
expression = Split[0] + "-" + Split[1] + "- \n" + Split[2]
return expression
Edit: Also, the attribute table for that file was empty. Edit Again: NVM, I didn't unzip properly
... View more
05-16-2014
02:04 PM
|
1
|
0
|
1153
|
POST
|
lol this would be alot easier if I had the dataset and could debug myself. I tend to make a few errors when writing scripts I needed to put the return expression within the if/elif statement I believe
def FindLabel ( [Name] ):
Split = [Name].split(",")
Split = Split[0] #drops everything after comma
Split = Split.split("-") #splits by the hyphen
if len(Split) == 2:
expression = Split[0] + "- \n" + Split[1]
return expression
elif len(Split) == 3:
expression = Split[0] +"-" + Split[1] + "- \n" + Split[2]
return expression
... View more
05-16-2014
01:52 PM
|
1
|
0
|
1318
|
POST
|
lol this would be alot easier if I had the dataset and could debug myself. I tend to make a few errors when writing scripts I needed to put the return expression within the if/elif statement I believe
def FindLabel ( [Name] ):
Split = [Name].split(",")
Split = Split[0] #drops everything after comma
Split = Split.split("-") #splits by the hyphen
if len(Split) == 2:
expression = Split[0] + "- \n" + Split[1]
return expression
elif len(Split) == 3:
expression = Split[0] +"-" + Split[1] + "- \n" + Split[2]
return expression
... View more
05-16-2014
01:44 PM
|
0
|
0
|
1318
|
Title | Kudos | Posted |
---|---|---|
1 | 02-22-2017 08:58 AM | |
1 | 10-05-2015 05:43 AM | |
1 | 05-08-2015 07:03 AM | |
1 | 10-20-2015 02:20 PM | |
1 | 10-05-2015 05:46 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|