|
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
|
5435
|
|
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
|
1128
|
|
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
|
4031
|
|
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
|
1128
|
|
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
|
3812
|
|
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
|
796
|
|
POST
|
Are you using versions? What is your method/criteria for selecting the records?
... View more
03-17-2015
09:39 AM
|
0
|
6
|
1128
|
|
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
|
3812
|
|
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
|
3812
|
|
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
|
838
|
|
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
|
2350
|
|
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
|
554
|
|
POST
|
We have some users that would like a way to reorder the fields of a feature class. I was hoping the field map control in the Merge tool would let you reorder but the up and down arrows in the box have no effect. After doing some searching, all the solutions I found required some coding. I developed a Python script based on the work by Josh Werts but they want something that works without looking at code. I was wondering if I could use the logic from the Python script and populate a multivalue parameter control in Model Builder with a list of field names, the user could rearrange it and then put it back into the Python script as a list for creating the new field map (which is then run through Merge to make the final feature class). I am pretty familiar with Python, but not so much with Model Builder. Any suggestions on the best way to accomplish this? The process would be like: Input FC Display fields User reorders fields in control Reordered fields are used in field map Field map used in Merge to output new FC with reordered fields
... View more
03-04-2015
09:04 AM
|
0
|
0
|
1768
|
|
POST
|
Just copy and paste your code into the post as plain text; forget the syntax highlighting.
... View more
03-04-2015
08:36 AM
|
0
|
1
|
369
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | a month ago | |
| 1 | 07-31-2025 11:59 AM | |
| 1 | 07-31-2025 09:12 AM | |
| 2 | 06-18-2025 03:00 PM | |
| 1 | 06-18-2025 02:50 PM |