|
POST
|
My initial question was not clear, my apologies. I'm creating a map book street index, for display purposed only. All of those values are within a string for a single record, so I'm trying to sort within that one string. I can alter the grid to add leading zeros (A01 instead of A1) but I'd rather avoid that if possible. My screen shot doesn't show any numbers smaller <10 but they're mixed in here and there.
... View more
08-01-2016
04:45 AM
|
0
|
2
|
5980
|
|
POST
|
My field had values like B3, M4, S5, E26, E10, E9, E11 (all within one field). I need to naturally sort so the values look like this: B3, E9, E10, E11, E26, M4, S5 I've tried the following code as suggested here, but it gives me an error stating "The value type is incompatible with the field type". If anyone has some suggestions I'd be interested! BTW I used this in Field Calculator import re def sorted_nicely( l ): """ Sorts the given iterable in the way that is expected. Required arguments: l -- The iterable to be sorted. """ convert = lambda text: int (text) if text.isdigit() else text alphanum_key = lambda key: [convert(c) for c in re.split( '([0-9]+)' , key)] return sorted (l, key = alphanum_key)
... View more
07-28-2016
11:26 AM
|
0
|
8
|
12091
|
|
POST
|
I'm exporting DDP as jpg images and I'd like to essentially create a custom world file for each page (I would need the N,S,E&W data frame midpoints in DMS). It's easy to get those values on my layout via dynamic text but I'd really like to have the coordinates readily available as text. Has anyone done this? Can I simply grab these data frame parameters for each page during the export process and write them out to a file? At the end of the day what I really want to do is drop these images in google earth and save as a KMZ. The caveat is that images can be no more than 1mp each so I need to tile all of my areas of interest then import to GE and georeference in that environment. Having the coordinates of the image extents makes it much easier to georeference the images in google earth (copy/paste). Alternate questions, is there an easier workflow that I'm missing?
... View more
07-25-2016
03:38 PM
|
0
|
0
|
1349
|
|
POST
|
Not sure what happened to the missing post but I did see all of the text via email notifications. Thanks Dan Patterson and Freddie Gibson for explaining the functions and finding a solution to my problem. This part by Freddie covered the initial problem. After some more thinking over the weekend I had a small suspicion that this might be the case (not returning int because the data is stored as a string). Thanks for confirming. Looking at your screenshot I'd assume your LeftPart field is a Text field because it allows you to store values other than numbers and decimals. As a result, even if the value in the field were '1234' the type would always return string because the values are stored as strings and not a numeric type (e.g. int, float, double).
... View more
07-18-2016
06:14 AM
|
0
|
0
|
1238
|
|
POST
|
Thanks, I'm sure this will be helpful in the future.
... View more
07-15-2016
01:21 PM
|
0
|
0
|
1238
|
|
POST
|
Thanks Dan, I appreciate the detailed response. I did find isinstance and started playing with it. What I'm really after is flagging non-integer values in a field. I'm parsing out house numbers from an address string and I want to flag any value that is not an integer for further review. Due to the nature of the data it's stored in a string field. def gettype(LPart):
return isinstance(LPart,int)
gettype( !LeftPart!) Calling the above function to populate the LType field gives the results shown above, but I would expect the last 3 rows to return 1 since they are integers. Is is returning false because the data is coming from a string field? Also, I see you are passing more arguments than just "int", I can't find any documentation on the classinfo argument, can you elaborate on that? Thanks, Rob
... View more
07-15-2016
01:20 PM
|
0
|
1
|
1238
|
|
POST
|
In field calculator this expression runs without an error, but it doesn't return a value. What am I doing wrong? type(!MyField!)
... View more
07-15-2016
12:06 PM
|
0
|
7
|
3051
|
|
POST
|
No definition queries, but the GDB is a decent size. I also realized I was checking out a few feature classes (including a large related table) that I do not typically include. The script did complete in the Desktop python window but it took 52 minutes. I'm currently trying again on a small GDB but it's still taking longer than it should.
... View more
06-09-2016
10:03 AM
|
0
|
0
|
953
|
|
POST
|
Ahhh gotcha, thank you. It was a reading comprehension fail on my part. I see what you're recommending now, and I found the blog post so it all makes sense. The blog post, for those who are curious Filenames and file paths in Python
... View more
06-09-2016
09:34 AM
|
0
|
0
|
953
|
|
POST
|
Thanks, I'll give it a try., but I don't think it's hung (the checkout gdb was semi-populated, so there was still "work" to be done when I cancelled). I'm currently trying to run it through the window in ArcMap but it's taking equally as long. Why use raw file names? The final goal is to loop through several versions and create checkouts for each, so I'd have to use variables in my paths at that point.
... View more
06-09-2016
09:01 AM
|
0
|
2
|
953
|
|
POST
|
I'm a bit new to python, but I decided to script out a workflow that I complete often (create checkout replicas). This is my first try at it, based on the sample script in CreateReplica_management help. I ran the script via PythonWin to test but I've cancelled it after > 1 hour run time. This would take <1 minute if I ran through the wizard in ArcMap. Any ideas/pointers? # Description: Create a checkout to a file GDB
# Import system modules
import arcpy
from arcpy import env
#get list of versions that will be checked out
version_list = "RLB"
#specify the checkout number for version & GDB naming
checkout_number = 1
#specify folder ocation and file name for checkout
working_folder = "D:\RLB\Python\CheckoutScript"
working_file = "TestCO_%s_v%s.gdb" % (version_list, checkout_number)
# Set workspace
env.workspace = "D:\RLB\Python\CheckoutScript\Water_D1_version%s.sde" % (version_list)
# Set local variables
in_data = ["Water_Network", "Water_Features"] # feature datasets
replica_type = "CHECK_OUT"
output_workspace = "%s\%s" % (working_folder, working_file)
replica_name = "MyReplica_%s_v%s" % (version_list, checkout_number)
access_type = "FULL"
initial_sender = "PARENT_DATA_SENDER"
expand = "USE_DEFAULTS"
reuse_schema = "DO_NOT_REUSE"
get_related = "GET_RELATED"
replica_geometry = ""
archiving = "DO_NOT_USE_ARCHIVING"
#create the empty GDB for checkout
arcpy.CreateFileGDB_management(working_folder, working_file)
# Execute CreateReplica
arcpy.CreateReplica_management(in_data, replica_type, output_workspace, replica_name, access_type, \
initial_sender, expand, reuse_schema, get_related, replica_geometry, archiving)
... View more
06-09-2016
08:29 AM
|
0
|
6
|
3612
|
|
POST
|
Thanks for mentioning this. I had found the documentation page you linked above, and I wondered why there wasn't a reference to .FormatDate() How would you grade arcpy documentation overall? While I'm learning more and more about python I anticipate some head scratching along the way, which is of course minimized by good documentation. However, I didn't anticipate struggling so much to find this particular solution, after all finding DatePart('yyyy',[DateField]) is so much easier. I'm interested to hear the opinion of someone experienced.
... View more
06-03-2016
12:02 PM
|
0
|
1
|
6094
|
|
POST
|
Thanks! Looks like dateutil has a lot of useful functions, which I'm sure will be helpful as I learn more python and tackle more complex problems.
... View more
06-03-2016
07:05 AM
|
0
|
0
|
1389
|
|
POST
|
Thanks, not sure why this was impossible to find (I searched and searched....).
... View more
06-03-2016
07:02 AM
|
0
|
0
|
6094
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 07-01-2025 05:11 AM | |
| 1 | 06-13-2022 11:18 AM | |
| 9 | 05-22-2025 04:45 AM | |
| 4 | 04-12-2024 09:00 AM | |
| 1 | 03-18-2024 04:34 AM |
| Online Status |
Offline
|
| Date Last Visited |
10-23-2025
05:36 AM
|