|
POST
|
Thanks, the FIDSet worked. I tried switching selections, but that raised an error on SelectLayerByAttribute - module has no attribute, and although it seems like it would be necessary to select an attribute, I don't see where it's required for that function in help. Anyway, thanks for the help, I really appreciate it. I'm trying to idiot-proof the script, and feel very qualified to test that. I have another question as to why GetParameterAsText retrieves the value entered ok, but will strip off all characters before a final "-" when I use CalculateField to set the field value, but I'll post that in another thread if I can't figure it out.
... View more
04-05-2012
07:07 AM
|
0
|
0
|
6309
|
|
POST
|
I want to check if any features in a feature class are selected, and exit the script with a message to the user if they aren't. But I can't find a function that checks if any features are selected. The code below gives a count of selected features, if any are, but it also returns a count of all features (~27k+) if none are. This defeats the purpose of the if statement. Is there a way to just check if any are selected - a HasSelected type of property? Thanks. # check how many parcels are selected count = int(arcpy.GetCount_management("Parcel").getOutput(0)) # returns count of all parcels if none selected. This makes if statement always true, regardless if any parcels are selected # if no parcels are selected, inform user and exit script if count < 1: arcpy.AddError("No features selected! \n Please select at least one parcel feature. \n") arcpy.AddError("Quitting the Create Case tool \n") sys.exit("Goodbye! Try again!")
... View more
04-04-2012
11:49 AM
|
0
|
8
|
10402
|
|
POST
|
I don't know if it's a property you retrieve the value from, although it seems like it should be. Anyway, you could keep track of the number of times you increase the radius and just add then up. Or, if the buffer is a circle, get the circumference (shape.length) and use this formula to get the radius:
R=c/pi/2
#R = radius, c = circimference
Caveat - I'm not a mathematician, formula from Google.
... View more
04-03-2012
01:58 PM
|
0
|
0
|
837
|
|
POST
|
Did you install the 64 bit version of pyscripter? ArcGIS uses 32 bit, even if your machine is 64. That can cause this error, according to Google results.
... View more
03-30-2012
01:08 PM
|
0
|
0
|
1142
|
|
POST
|
I don't work much with rasters, so maybe this wouldn't work or ArcGIS doesn't support it, but can you run a selection like a "Select Distinct Value..." to get unique values? If so, you could then export them into a table. Sorry if I'm off base here, I'm thinking in SQL, maybe this is not even on the horizon with rasters.
... View more
03-30-2012
12:31 PM
|
0
|
0
|
1056
|
|
POST
|
Never mind, figured it out. If anyone else runs into this, the problem was that Cases data source pointed to a mapped drive path to the data "P:\TestCases_Geodatabase.gdb", while the workspace and some other feature classes used the UNC path "\\TestServer\TestCases_Geodatabase.gdb". It's the same location, but apparently ArcGIS is picky about it.
... View more
03-30-2012
08:38 AM
|
1
|
0
|
1248
|
|
POST
|
Any ideas why Append is throwing the error below? There are three parcels selected, that I'm trying to append to the Cases feature class. As far as I can tell, there's absolutely nothing that's using Cases. No one else has access to this geodb, so it's not a case of another user, and I'm not doing anything else with it. Using Append from the toolbox works fine. Thanks. Code: import arcpy from arcpy import env env.workspace = r"\\TestServer\TestCases_Geodatabase.gdb" #------------------------------------------------------------------------------- # Append selected parcels to Cases # def AppendParcelsToCases(): input = "Parcel" target = "Cases" schemaType = "NO_TEST" try: arcpy.Append_management(input, target, schemaType) except Exception as e: arcpy.AddError("Error creating case feature! \n" + e.message) Error: Executing: CreateCase Start Time: Fri Mar 30 11:01:12 2012 Running script CreateCase... Error creating case feature! ERROR 999999: Error executing function. Cannot acquire a lock. Cannot acquire a lock. [The table Cases is being written by another process.] Cannot acquire a lock. [The table Cases is being written by another process.] Failed to execute (Append). Completed script CreateCase... Failed to execute (CreateCase). Failed at Fri Mar 30 11:01:16 2012 (Elapsed Time: 4.00 seconds)
... View more
03-30-2012
08:08 AM
|
0
|
1
|
1997
|
|
POST
|
Have you checked your PATH file to make sure everything's pointing to the right directories?
... View more
03-30-2012
07:54 AM
|
0
|
0
|
1152
|
|
POST
|
I don't know about all the Microsoft html help, but you can add help to the tool itself. Click on the tool in ArcCatalog, click on the Description tab in the large pane, click Edit, and you can add the help text that displays when you run the tool, or you can see it in the Description tab. It will also show up in the Catalog tab in ArcMap and Arc Toolbox by right clicking and selecting either Help or Item Description. Help just displays the help while Item Description allows editing it.
... View more
03-29-2012
07:06 AM
|
1
|
0
|
3755
|
|
POST
|
Well that does the job! Thanks Darren & Mathew, I very much appreciate it. Wish I could mark both posts as an answer, but gave both points. I'm going to go through the code to see exactly what it's doing; still don't know why the buffer wouldn't be added automatically, but whatever. It's working and will make my job in the future much easier by letting others run the script and stop asking me to do it for them manually.
... View more
03-28-2012
09:51 AM
|
0
|
0
|
1183
|
|
POST
|
Thanks, I'll look at that. My goal is to create a 200' buffer (that's working), display it on the map (nope, should be default?) and symbolize it based on a .lyr file - 2.00 red line (also no, although my guess is that's because the buffer itself doesn't show up). Making another layer seems redundant, especially when it's not a problem to do manually, but maybe that's how it'll have to be. In tutorials the buffer layer always shows up. This leads me into a pet peeve about ArcGIS help. It sometimes uses the term layer to refer to a layer in the map - shapefile, feature class, etc - and sometimes to only refer to a .lyr file only. Kind of sloppy editing there. Also, why have to use a .lyr file for operations that manually can use feature classes? Maybe 10.1 will do something about this.
... View more
03-28-2012
09:06 AM
|
0
|
0
|
1183
|
|
POST
|
Thanks, that's a good thing to double check. The box in options is checked, though, so doesn't seem to be the issue.
... View more
03-28-2012
08:39 AM
|
0
|
0
|
1183
|
|
POST
|
Since you're using r I don't think you'd use forward slashes. Try regular backslashes: env.workspace = r"C:\asdf\asdf.gdb"
... View more
03-28-2012
06:30 AM
|
0
|
0
|
1717
|
| 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
|