|
POST
|
Well, where is your feature getting it's color from? You're symbolizing by something, whether the whole feature class or shapefile has one color or different features in the feature class/shapefile have different colors. If you're using one color for all features, then just select all the records in that feature class. That's probably not what you want, so you're symbolizing different features in a feature class with different colors based on values in one or more attribute fields. You'd select red, blue, green, etc. records using the same criteria to you use to symbolize them. Afaik, there's no way to select directly on the color itself. The color isn't part of the feature class or the feature itself. Maybe you could do it in Python by checking the RGB values, I don't know. I suppose you could add a field called Color, give it the text value 'red', 'blue', etc. and select on that, but that's still an attribute selection and a poor way to go about it. A .lyr file retains the symbology, but I still don't know how you'd select by color. I apologize if I misunderstand your question, but I don't see any way short of possibly some kind of script (and don't know about that) to do what I think you want. Maybe there is a way and someone else will jump in with a method.
... View more
05-08-2012
01:13 PM
|
0
|
0
|
937
|
|
POST
|
I don't know if you can select by symbology. Why not just select on whatever attribute the symbology is based on? For example, if your symbology has a field Voted for states that voted Republican red, Democratic blue, other parties green, and you want to select all red states, just select for Republican in the field Voted.
... View more
05-08-2012
08:04 AM
|
0
|
0
|
937
|
|
POST
|
I added COGO fields to a line feature class table in a file geodatabase in ArcCatalog, and then used the Traverse tool on the COGO toolbar to create a parcel. But whenever I do this, I get the error below when I click Finish on the COGO box. This happens with every parcel. If I delete the COGO fields, it works fine. Any ideas on how to fix this? I didn't find anything searching support. Thanks. [ATTACH=CONFIG]14143[/ATTACH]
... View more
05-07-2012
08:18 AM
|
0
|
1
|
606
|
|
POST
|
If you're going to have a lot of elifs, sometimes it's easier to make a spreadsheet,txt or csv file with the data and join it to the existing table based on the common field, CO in this example. You can then either leave the join or export the whole thing to a new feature class or shapefile.
... View more
04-28-2012
08:55 AM
|
0
|
0
|
1345
|
|
POST
|
This is a generic type question, no specific problem involved. What is good practice in deciding when to use del in a script? For example, I use it when done with a mapping.MapDocument object, but some of the Help files in the Resource Library seem to use it on variables as well. I don't see the point of that, but not a python expert either. Is there a guide to when you should use it? I looked at the Python documentation, but it was kind of obscure to me, especially when the documentation contains statements like "Rather than spelling it out in full details, here are some hints."
... View more
04-10-2012
01:30 PM
|
0
|
4
|
1239
|
|
POST
|
Thanks Bruce, that works great. I thought I had tried the escape \, but guess not correctly. How would this work for a variable, fld in the code snippet? Even though I don't expect the field name to change, I don't like using hard coded values if I can avoid it.
... View more
04-10-2012
10:09 AM
|
0
|
0
|
746
|
|
POST
|
I'm trying to set up a definition query for a layer, but can't get the formatting correct. I've tried several variations of the code below w/o success, such as writing the query out in triple double quotes (which for some reason required an extra double quote) . Appreciate any help. This kind of thing was easier in the old days of VB & VBA. Code: case_number = arcpy.GetParameterAsText(0) fld = "Case_" # tried substituting this for "Case_" in the line below, for example. query = '"%s"' + " = " + "'%s'" % ("Case_", case_number) #1st %s is single, double, double single quotes; 2nd is double single single double # query should look like "Case_" = 'A-BC-12-34' where case_number = A-BC-12-34, Error: <type 'exceptions.TypeError'>: not all arguments converted during string formatting
... View more
04-10-2012
09:50 AM
|
0
|
4
|
1510
|
|
POST
|
What do you mean by 'select a file on disk'? Select it in Windows Explorer? Don't you just select features either manually with the Select tool, or with a query from the Selection menu, from the attribute table dropdown, or via arcpy? Guess I've just never run across that term.
... View more
04-09-2012
01:50 PM
|
0
|
0
|
1287
|
|
POST
|
Well, that's odd. When I run the buffer tool in arcpy, it only runs on selected features. Are you using ArcGIS 10? Shapefiles or feature classes? How many features does the selection tab in the TOC show selected? If you're selecting the features in arcpy, try selecting them manually before running the buffer to see if that makes a difference. Or vice versa.
... View more
04-09-2012
10:27 AM
|
0
|
0
|
1287
|
|
POST
|
I'm not sure if you can check the box, but I believe most tools, including buffer, only run on selected features, if there are any selected. I think the actual dialog box has the checkbox selected by default; either that, or it's an option or uses the last checked/unchecked status. Mine's always checked, so not sure.
... View more
04-08-2012
02:05 PM
|
0
|
0
|
1287
|
|
POST
|
Thanks. I didn't think that would be necessary using the variable from a parameter, but very helpful to know.
... View more
04-05-2012
06:55 PM
|
0
|
0
|
3336
|
|
POST
|
I've looked everywhere I can think of for a solution, or at least similar problem, to this but can't find one. The script gets a user entered value via GetParameterAsText(0). The value normally contains '-' characters, a typical one taking the form Z-FY-12-34, for example. When I try to set a text field to this value, CalculateField apparently treats the value as a number, subtracting the numbers and discarding the letters; the value then gets set to something like -46. I'm not sure it actually subtracts, but it always returns a - followed by a number. Whenever I check the value in the script, it looks correct. I'm guessing that maybe this is related to using r to accept a raw string, but I don't know how to do that with GetParameter..., and maybe that's not the actual problem anyway. Any ideas on what the cause is and how to fix it? Thanks. case_number = arcpy.GetParameterAsText(0) # user enters Z-FY-12-34 . . . fc = "Cases" fld = "Case_" arcpy.AddMessage("Adding Case number " + case_number + " added.") # case_number = Z-FY-12-34 try: arcpy.CalculateField_management(fc, fld, case_number) # field value set at -124 or some other number arcpy.AddMessage("Case number " + case_number + " added.") # case_number = Z-FY-12-34 except Exception as e: arcpy.AddError("Error setting Case_ field value to case number. \n" + e.message)
... View more
04-05-2012
11:19 AM
|
0
|
9
|
4331
|
|
POST
|
Thanks, I'll try that. Surprised I didn't see it myself. Maybe I should actually look before I just copy & paste... 😉
... View more
04-05-2012
09:35 AM
|
0
|
0
|
6312
|
| 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
|