|
POST
|
You can do this in PyScripter. Go to Tools ---> Options ---> IDE Options Then in the Code Completion part add arcpy to the Special Packages list. It does have a noticeable impact on performance though. It will hang for a few moments sometimes on the first load but once it gets the special packages read, it works fine.
... View more
03-18-2015
02:25 PM
|
0
|
4
|
3408
|
|
POST
|
Thanks Jake, that was very helpful. The only extra step I needed was to add a new directory (of type Cache) in ArcGIS Server Manager (not just the data store registered folders). That allowed me to choose the new cache directory in step 4 you described. And an extra note on that, the cache directory that you add needs to be the folder containing the cache folder, not the folder that contains the cache file. The first time I added the directory in Server Manager, I went all the way down to the last folder that contained the cache file, but it actually needs to be one folder up from that.
... View more
03-18-2015
02:17 PM
|
1
|
0
|
2459
|
|
POST
|
I created a compact cache for aerial photorgraphy from a map service. The cache was created locally on the server in the default \arcgisserver\directores\arcgiscache but we don't have much space on the server so I moved it to a network drive. I registered the network drive location as a data store with ArcGIS Server, so now how do I create a new map service that uses this cache in the new directory?
... View more
03-18-2015
09:39 AM
|
0
|
8
|
6170
|
|
POST
|
So is everyone editing on the same version? You can test it now by just creating a new version.
... View more
03-17-2015
10:27 AM
|
0
|
2
|
1582
|
|
POST
|
Seems like you would want to create the search cursor on just the selected features instead of everything in the point feature class. I think the way you have it now would copy all rows in the point feature class to the related tables each time a new point was added (creating duplicate records in the related tables).
... View more
03-17-2015
10:24 AM
|
0
|
0
|
4881
|
|
POST
|
If you are editing the same record on the same version as someone else, there is conflicting data. I don't know why ArcMap would just crash, but I can see that there is potentially a problem here. Can you try doing this without anyone else editing or create a new version to do your edits in? I've used calculate field in ArcMap on thousands of records without issue; it just took a bit to process.
... View more
03-17-2015
10:05 AM
|
1
|
4
|
1582
|
|
POST
|
Yeah, I was looking at the return value for the next() method. I see the second second sentence at the very beginning clearly says: Returns an iterator of lists. But down at the bottom under the Method overview for next(), it says: Returns the next row as a tuple. I tested both the next() method and just iterating through the whole cursor in a for loop and both give the row as a list (like you said). Esri's documentation for the next() method is just wrong.
... View more
03-17-2015
09:51 AM
|
1
|
1
|
4741
|
|
POST
|
When you make directory path strings, you can either use the double backslash to escape the special character, or you can use the r prefix to designate the string as "raw" so it will not consider a single backslash as a special character. You have combined both methods and will probably not work. You need to do one or the other. Personally, I like to use the raw string method: arcpy.env.workspace = r"G:\GISAdmin\Database_Management\Compress.sde"
... View more
03-17-2015
09:43 AM
|
1
|
0
|
1020
|
|
POST
|
Are you using versions? What is your method/criteria for selecting the records?
... View more
03-17-2015
09:39 AM
|
0
|
6
|
1582
|
|
POST
|
Even though the documentation says tuple, it does return a list. Thanks for the clarification!
... View more
03-17-2015
08:45 AM
|
0
|
3
|
4741
|
|
POST
|
In addition to the points Darren Wiens made, the rows returned by the update cursor are a tuple. In Python, a tuple is what's called an immutable object; it cannot be changed. You have to convert the row from a tuple to a list before you can change the values. Then you can pass the altered row list back to the cursor's updateRow() method (which accepts a tuple or list). You can also create the update cursor with only the fields you are interested in so you don't have to loop through all the fields unnecessarily. This code assumes the data type of the length_val field is integer. It also assumes that if total_length was a string, that it would never have more than one number. aoi_fields = ["total_length", "length_val"]
with arcpy.da.UpdateCursor(aoi_table_gdb, aoi_fields) as cursor:
for row in cursor:
rowList = list(row)
if isinstance(rowList[0], int) or isinstance(rowList[1], float):
rowList[1] = int(rowList[0])
elif isinstance(rowList[1], basestring):
# Pull out only the number from the string
rowList[1] = int(filter(str.isdigit, rowList[0]))
else:
rowList[1] = None
cursor.updateRow(rowList) I used this thread for extracting the number from the string. Alternatively, you could use Calculate Field to do this (instead of an arcpy.da cursor).
... View more
03-16-2015
04:26 PM
|
2
|
5
|
4741
|
|
POST
|
Assuming this is the snippet of code you're asking about? for lyr in arcpy.mapping.ListLayers(mxd, "CRASHES1999", df):
if lyr == "CRASHES1999":
desc = arcpy.Describe("CRASHES1999")
in_table = "CRASHES1999"
field_names = "YEAR"
if desc.FIDSet:
with arcpy.da.SearchCursor(in_table, field_names) as cursor:
for row in cursor:
arcpy.MakeFeatureLayer_management(in_table, "SelectedCrashes1999")
else:
print "No Features Selected for CRASHES1999"
del desc
del in_table
del field_names Did you have a specific question or problem? Just guessing, but I see you're passing the field names for the search cursor as a string. According to the documentation, it needs to be a list or tuple. Try this instead: field_names = ["YEAR"]
... View more
03-11-2015
12:06 PM
|
0
|
1
|
944
|
|
POST
|
Same. Worked for me in PyScripter with ArcGIS 10.2.2 using a path to the local C:\ drive.
... View more
03-11-2015
11:55 AM
|
0
|
0
|
2984
|
|
POST
|
You could try using arcpy's Table to Table Conversion instead of dbfread. That would also let you use the arcpy.da cursors for easy iteration over the rows. Could you post a sample of what your desired overall accuracies output would look like?
... View more
03-10-2015
10:14 AM
|
0
|
0
|
749
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 10-23-2025 03:53 PM | |
| 1 | 3 weeks ago | |
| 1 | 03-19-2026 08:59 AM | |
| 1 | 02-12-2026 01:37 PM | |
| 1 | 12-01-2025 06:19 AM |