POST
|
Hi Gyeyoung. I've been checking the syntax on Esri help. I see that the 4th parameter "search_distance" is optional, but is a numeric parameter. So, what I think it is doing, is assume that you don't give an optional numeric parameter, and it reads the empty string as the 5th parameter. With other words, try this: arcpy.SelectLayerByLocation_management(lu_lyr, "COMPLETELY_CONTAINS",muniLoc,0,"SWITCH_SELECTION") ...giving zero instead of empty strig "". I think it will take it as the numeric 4th parameter, and after it will execute your switch selection. Hope it helps. Good luck! Luis Pascual
... View more
10-27-2015
08:00 AM
|
0
|
0
|
701
|
POST
|
Hi Ronald. In Model Builder, first you have to convert your feature class to feature layer with 'Make Feature Layer' function, and then you can perform the 'Select by Location' function, with intersect option, or any other, or add a join... The 'Select By Attribute' function, you can perform it directly on your Feature class with the 'Select (Analysis)' tool. With grids.... I don't know, but try in this way... Good luck! Regards, Luis
... View more
10-14-2015
09:33 AM
|
1
|
0
|
8771
|
POST
|
Hi Ben. I'm thinking that if you already have a raster, first clean black pixel and after convert to polygon if you need it. You can use the SetNull function to operate with pixel values, and obtain a new raster keeping only the pixel you want to. Into the sentence, the SetNull function will give the 'NoData' value to the pixel that will match the expression. The rest will remain with the value you want, for example 1. It will be something like (Assuming that the black pixels have a 0 value): # Check out the ArcGIS Spatial Analyst extension license arcpy.CheckOutExtension("Spatial") # Execute SetNull outSetNull = SetNull(BlackPixRast, 1, "VALUE == 0") # Save the output outSetNull.save("C:/TEMP/newRaster") # Convert To Polygon arcpy.RasterToPolygon_conversion(newRaster, BlackPixPoly, "SIMPLIFY") Good luck! Luis Pascual
... View more
09-28-2015
01:58 AM
|
0
|
1
|
448
|
POST
|
Hi Johannes. I had the same problem with spanish characters, and I found a solution with this sentence at the first script line: # -*- coding: cp1252 -*- Including the comment char, the initial hash key ==> # If this charcode, cp1252, doesn't work, try another one, UTF-8 or similar. Good luck! Luis
... View more
02-10-2015
12:15 AM
|
1
|
0
|
1129
|
POST
|
Hi again. Reviewing your issue, the error given by the 'select' function is due to the expression: """"COUNTY_CODE" = code[0]""" You'are passing to the function the literal "code[0]" that is an unknown variable for it. If you try: """"COUNTY_CODE""" = " + code[0] I think that will run ok with your original code because python will replace it with the value of the list in this position. Good luck! Luis
... View more
02-04-2015
06:27 AM
|
0
|
4
|
941
|
POST
|
Hi Matthew Try something like this, with an iterator 'for', between the first position 0 and the 45th?? number 44. It isn't necesary delete every item, the loop will read every position in every iteration. import arcpy code = ["007","013","014","015","017","019","021","023","027","029","031","033","035","037","039","041","043","045","047","049","051","055","059","063","065", "067","069","075","077","081","083","085","091","097","099","101","103","105","107","109","113","117","119","123","125"] cnty = ["Archuleta","Boulder","Broomfield","Chaffee","Cheyenne","Clear_Creek","Conejos","Costilla","Custer","Delta","Denver","Dolores","Douglas","Eagle","Elbert","El_Paso","Fremont","Garfield", "Gilpin","Grand","Gunnison","Huerfano","Jefferson","Kit_Carson","Lake","La_Plata","Larimer","Logan","Mesa","Moffat","Montezuma","Montrose","Ouray","Pitkin","Prowers","Pueblo","Rio_Blanco", "Rio_Grande","Routt","Saguache","San_Miguel","Summit","Teller","Weld","Yuma"] try: for i in range(0, 44) arcpy.SelectLayerByAttribute_management("Colorado_Clip","NEW_SELECTION",""""COUNTY_CODE""" = " + code) ## Verify your path, if your running in windows, use the first 'copy' statement with backslashes \ #arcpy.CopyFeatures_management("Colorado_Clip","H:\GIS DATA\Data\Conflation\RPAM Data NAD83.gdb\Colorado\" + cnty,"#","0","0","0") arcpy.CopyFeatures_management("Colorado_Clip","H:/GIS DATA/Data/Conflation/RPAM Data NAD83.gdb/Colorado/" + cnty,"#","0","0","0") arcpy.SelectLayerByAttribute_management('Colorado_Clip', "CLEAR_SELECTION") #del cnty[0] #del code[0] print cnty print code except: print code[0] + " Failed" I hope it helps. Luis
... View more
02-04-2015
06:19 AM
|
0
|
5
|
941
|
POST
|
Hi Johannes. Why don't you try to write every backslash double? I mean that every special character need to be scaped, and the scape character is the backslash. For example: print (('R:\\Karto\Bierer2014\\Datenabgabe\\20150113_Brandt\\raster\\' + '(!OBJECT_ID!)' + 'ext').strip('utf-8')) I hope it helps. Luis
... View more
01-27-2015
02:34 AM
|
1
|
1
|
912
|
POST
|
Hi Dan. I'm not able to test it right now but, have you tried this? if "CANC" in row[0] or not row[1] == '#': I hope it helps. Luis
... View more
01-15-2015
05:51 AM
|
0
|
0
|
3090
|
POST
|
Hi Sallie. Have you tried to execute the query into a SQL text window? Is there any posibility? I don't know which application you are using, but if you can, maybe it can helps: select * from dbo.lwmain where inci_id LIKE '14036678%'. Other question; while I'm writting, I can see that the simple quotes are different between yours and mine. It depends on the text editor used, can be other character. If you open a simple notepad and copy/paste this: ’ Your simple quote ' My simple quote As you can see, they are not the same char. Test in your query builder if it runs with this simple quote: inci_id LIKE '14036678%' Good luck! I hope it helps, Luis
... View more
11-19-2014
06:27 AM
|
0
|
2
|
522
|
POST
|
Hi again. It looks like the value entered in the script execution dialog window (where you have written the parameter declared into scripts parameters) is a literal like "HiStand_polygon" and it cannot be converted to float.Have you entered a number in this parameter at execution time? Is it the only one or do you have more parameters? You know the order is important, the first parameter declared has position number 0, the second has 1, and so on... I can't think anything else, well, only one comment: why don't you get the parameter at the beginning of the script? Maybe you can isolate the problem. I mean that there are others function calls along the code and the script can override the "parameter" value with the last one executed. (I don't know exactly, it's only an intuition). Good luck! Luis
... View more
11-12-2014
04:48 AM
|
2
|
1
|
786
|
POST
|
Hi Alcaraz. What about this? AreaFilter = arcpy.GetParameter(0) #If you want to convert to float: AreaFilter = float(arcpy.GetParameter(0)) I used this code in v9.3: import sys AreaFilter = sys.argv[1] # The first argument has index number 1 I hope it helps. Good luck! Luis
... View more
11-12-2014
02:19 AM
|
0
|
1
|
786
|
POST
|
Hi Stephen. In ArcGIS 9.3 (python 2.6) I had this code: gp = arcgisscripting.create(9.3) # You can change it for import arcpy in v10 intable = gp.GetParameter(0) # this is the layer. If you have it already in a variable, it's done. # open cursor rows = gp.searchcursor(intable) # ...or arcpy instead of gp, # maybe the correct sintax of this function in v10 is SearchCursor, read the help reference below row = rows.next() And now, check the row variable and decide if continue or not. Good luck! I hope it helps Help reference of this function: Ayuda de ArcGIS 10.1 Luis
... View more
11-05-2014
07:07 AM
|
0
|
1
|
1136
|
Title | Kudos | Posted |
---|---|---|
1 | 10-14-2015 09:33 AM | |
1 | 01-27-2015 02:34 AM | |
1 | 02-10-2015 12:15 AM | |
2 | 11-12-2014 04:48 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|