|
POST
|
Why is there even a .str() method option? There is no .str() method in python......
... View more
03-29-2017
12:34 PM
|
0
|
0
|
495
|
|
POST
|
The only reason this wouldn't work is if your field was not a text field, or your text field character limit was less than 8 characters.
... View more
03-29-2017
12:32 PM
|
2
|
2
|
1994
|
|
POST
|
If you are having issues with a script, it is recommended to post the script and the error so people know where you are going wrong. http://desktop.arcgis.com/en/arcmap/10.3/tools/data-management-toolbox/calculate-field.htm arcpy.CalculateField_management("yourfilehere", "Status",
'Existing', "PYTHON_9.3")
... View more
03-29-2017
12:04 PM
|
1
|
1
|
1994
|
|
POST
|
I suppose really on what exactly you are wanting to do with it and how your data is arranged. I will say though that I have improved on that code pretty significantly and plan to do so again. The biggest inefficiency in that script is everything takes place within the cursor which slows stuff down ALOT(It took 4 days to create about 4500 map documents and PDFs). I'm planning to read everything to a dictionary in the future and then looping through the dictionary(See /blogs/richard_fairhurst/2014/11/08/turbo-charging-data-manipulation-with-python-cursors-and-dictionaries?sr=search&searchId=117ed577-1c9e-4907-9dd8-4c385595cdbb&searchIndex=3 for help with that if you want to implement) and create the maps. The other thing I changed significantly is I use definition queries to subset my layers now instead of selecting them and making a new layer each time. I have a few other tricks I've developed since then as well, such as turning layers on and off if they intersect with other layers, moving text elements to a location on a map with a fixed extent. Scale bars can be tricky when working with multiple scales(I do everything in multiples of 1:1200, since most of my maps are of fairly small areas and my engineer likes everything nice and even on an engineering scale.), as are legends when all the classes may or may not be in the map extent. I recommend planning out exactly how you want things to look for each map and test your script as you go on small subsets of your data to make sure it works as you think it should. I also cannot reiterate how important it is to go and name all the elements of whatever map templates you develop to make all the features easy to access with python. If you have questions about anything feel free to ask. Ian
... View more
03-29-2017
12:00 PM
|
0
|
2
|
2508
|
|
POST
|
I'm having a fairly busy workday today so can't really flesh out some starter code at the moment. I did dig up an old post I had where I posted a good portion of code I used for this function(Down towards the bottom). Its fairly idiosyncratic to my set-up but should give plenty of examples for doing many of the things you would need to do for your map automation. https://community.esri.com/thread/160192
... View more
03-29-2017
09:25 AM
|
1
|
4
|
2508
|
|
POST
|
If you are running this as a standalone script, you will need to have arcpy check out a Spatial Analyst Extension.
... View more
03-24-2017
12:41 PM
|
1
|
6
|
2547
|
|
POST
|
Hi Bryan, I actually do this fairly extensively, managing several thousand map documents that are automatically created based on ObjectIDs using python and the arcpy mapping module. I use a search cursor to loop through each record in a geodatabase feature class, collect all the attribute information I need into variables and use them to subset my layers already on a map template and update text elements and other layout elements on my map. It then saves a copy of the map using the ID number and other attributes and saves them to specified output folders. Search Cursor http://desktop.arcgis.com/en/arcmap/10.3/analyze/arcpy-data-access/searchcursor-class.htm Help with Arcpy mapping module https://community.esri.com/docs/DOC-1778 If you are going to use a map template as a base, I would recommend naming all the text and layout elements in the map you are wishing to change in order to make them easier to access via arcpy.mapping. If you are interested in this let me know and I can post some good starter code for you with examples for setting up a cursor, accessing map documents in memory, changing layout elements and querying layers in the TOC, changing the dataframe extent and scale, saving and exporting maps, etc. However, I do not use a combo box as I designed my script to run standalone but I'm sure you could adapt it to a combo box if needed. Ian
... View more
03-24-2017
12:22 PM
|
0
|
6
|
2508
|
|
POST
|
The helps tells you exactly the difference. The Input Base Features are compared with the Input Test Features. Input Base Features refers to data that you have declared valid. This base data has the correct geometry definitions, field definitions, and spatial reference. The Input Test Features are compared against the Input Base Features. Input Test Features refers to data that you have made changes to by editing or compiling new features.
... View more
03-24-2017
10:33 AM
|
1
|
2
|
815
|
|
POST
|
The hyphens are invalid characters for the shapefile name, replace them all with underscores and it should work fine. Cur_Date = datetime.datetime.now().strftime("%y_%m_%d_%H_%M") Output_Shape = "Properties_" + Cur_Date + ".shp"
... View more
03-24-2017
10:26 AM
|
1
|
7
|
3329
|
|
POST
|
I would recommend setting the current date and time to a variable and concatenating it into your file name. import datetime
import time
Cur_Date = datetime.datetime.now().strftime("%y-%m-%d-%H-%M")
print "current date and time is " + Cur_Date
Output_Shape = "Properties-" + Cur_Date + ".shp"
print "New shapefile being written will be called " + Output_Shape
arcpy.FeatureClassToFeatureClass_conversion(Sheet1_Layer, CuroProperties, Output_Shape)
... View more
03-24-2017
09:44 AM
|
1
|
10
|
3329
|
|
POST
|
You can use Arcpy.Exists to check if the dataset already exists and if it does, make the output a concatenation of the current date with the name and file type of your output. http://stackoverflow.com/questions/311627/how-to-print-date-in-a-regular-format-in-python
... View more
03-24-2017
07:25 AM
|
1
|
12
|
3329
|
|
POST
|
Hm it does create the GDB when you set it equal to a variable. I guess the issue with your script is the fact that arcpy.env.workspace is looking for a workspace as an input, whereas you were setting it equal to geoprocessing operation that creates the workspace.
... View more
03-23-2017
07:56 AM
|
0
|
0
|
4585
|
|
POST
|
Can you check to make sure it creates the GDB? I think its not creating it at all. Make line 11 just: arcpy.CreateFileGDB_management(basedir, gdb_name) Right now instead of creating the actual gdb, you are setting a variable equal to it, which I'm not sure what that would do but it likely isn't creating it.
... View more
03-23-2017
07:23 AM
|
1
|
2
|
4585
|
|
POST
|
You are missing the file extension in your gdb variable. gdb_name needs the extension on it before you join the path.
... View more
03-23-2017
07:04 AM
|
1
|
4
|
4585
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 02-22-2017 08:58 AM | |
| 1 | 10-05-2015 05:43 AM | |
| 1 | 05-08-2015 07:03 AM | |
| 1 | 10-20-2015 02:20 PM | |
| 1 | 10-05-2015 05:46 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:23 AM
|