|
POST
|
You'll need to make it a date object instead of a string I believe. Something like this maybe. (untested) datetime.datetime.strptime('!unsplit!.split(',')[0], "%d.%m.%Y")
... View more
09-26-2012
12:44 PM
|
0
|
0
|
917
|
|
POST
|
Is there a limit to the number of characters in a workspace path when using the Pyton Window? This example from a tutorial works fine: >>> mxd.replaceWorkspaces("D:\Student\PythonDesktop10_0\Data\Austin_test.gdb", "FILEGDB_WORKSPACE", "D:\Student\PythonDesktop10_0\Data\Westerville.gdb", "FILEGDB_WORKSPACE") But this does not: >>> mxd.replaceWorkspaces("D:\Student\PythonDesktop10_0\Data\Westerville.gdb", "FILEGDB_WORKSPACE", "W:\AEP\127142_Opossum_Creek_Smith_Mtn\PER\Environmental\GIS\Data\temp\Austin_test.gdb", "FILEGDB_WORKSPACE") Runtime error <type 'exceptions.ValueError'>: MapDocObject: Unexpected error If those were the example paths given they are setting you up for failure. You bombed here \temp \t in a string is read as a tab. To avoid this issue use double \\, / or the easiest method in my opinion, the r tag before your string. mxd.replaceWorkspaces(r"D:\Student\PythonDesktop10_0\Data\Westerville.gdb", "FILEGDB_WORKSPACE", r"W:\AEP\127142_Opossum_Creek_Smith_Mtn\PER\Environmental\GIS\Data\temp\Austin_test.gdb", "FILEGDB_WORKSPACE") You can read more about string literals, what they do and how to avoid them here. http://docs.python.org/reference/lexical_analysis.html#string-literals
... View more
09-26-2012
12:28 PM
|
0
|
0
|
879
|
|
POST
|
As I said before this line seems to be the culprit. if layer.name.lower() == "BND_GDT_CNTY": Nothing after that will process. You will want to replace .lower with .upper as I posted above.
... View more
09-26-2012
10:46 AM
|
0
|
0
|
918
|
|
POST
|
Hi all, I've had to change the script to just accept coordinates that are written into a .py script. The programmer doesn't want a tool - just a script that has been tested successfully for a set of coordinates to retrieve attribute values for that point. So I've changed the script to the following. The commented out code is potential code for writing the output values to a .txt file, but for now I jsut want the values printed in the PythonWin Interactive Window, so that I can see what I'm getting. My code seems to be stuck at "for layer in arcpy.mapping.ListLayers(mxd, '', df): print(layer)". It prints the layers into the Interactive Window and then gives me a message ".py returned exit code 0". Nothing else processes after this step and I don't get any error messages to help me. Attached is a .zip with a .gdb, .py and .mxd. Suggestions? I think you forgot to attach your files. Also to post code in the forums use [ CODE] [/ CODE] tags. At a cursory inspection this line will never return anything. if layer.name.lower() == "BND_GDT_CNTY": You'll want this I believe. if layer.name.upper() == "BND_GDT_CNTY":
... View more
09-26-2012
10:19 AM
|
0
|
0
|
918
|
|
POST
|
My three favourite resources, in no particular order. http://www.google.com/ http://resources.arcgis.com/en/help/main/10.1/#/A_quick_tour_of_Python/002z00000023000000/ http://docs.python.org/release/2.7.2/ Everything I know about python and scripting geoprocessing I've learned from those and these forums.
... View more
09-26-2012
09:15 AM
|
0
|
0
|
2661
|
|
POST
|
"Workspace or data source is read only." seems to indicate some rogue locking going on. I'd try creating a function for your SA calls and calling that from your loop. I've found it has helped me with the the dreaded 9's error. I'm assuming you haven't changed computers when you switched from 10.0 to 10.1 and you haven't had any changes in local or domain permissions. The randomness of your errors seem to preclude these anyways. How is your memory usage while running this? If your process starts getting over 2GB you are going to get some problems. As an aside I only loop intensive tasks outside of cursors by creating a dictionary or list of the required parameters you want to base your loop on.
... View more
09-25-2012
01:37 PM
|
0
|
0
|
2484
|
|
POST
|
Hi there, I have a question about this part of the code: if layer.name.lower() == "cities": why do you put ".name.lower()" what does .lower mean? The lowest layer in the dataframe toc? Is it necessary to write this? I will have more than one layer in mine.. Thanks for clarifying. Christi It is so it can pick whatever layer is called "cities" regardless of capitalization. So it would return "Cities", "CITIES", "cities" etc.
... View more
09-25-2012
12:24 PM
|
0
|
0
|
918
|
|
POST
|
Something like this? http://www.addedbytes.com/cheat-sheets/download/python-cheat-sheet-v1.png There are lots out there already, not sure why something like this is necessary to create from scratch. Also consider there are different versions of python and some commands change between them.
... View more
09-25-2012
12:04 PM
|
0
|
0
|
1998
|
|
POST
|
You will need to pass it as a parameter to the function or make it a global variable.
... View more
09-24-2012
11:15 AM
|
0
|
0
|
2917
|
|
POST
|
ArcGIS Server Enterprise doesn't tell you your license level, just the number of licenses and servers you can deploy to. http://www.esri.com/software/arcgis/arcgisserver/features/functionality-table Also make sure you use UNC paths when executing scripts on a server. You are getting a "does not exist Failed to execute" error, so it seems it can't find your data more than a license level problem.
... View more
09-12-2012
05:50 AM
|
0
|
0
|
850
|
|
POST
|
You should be able to just check this option in the attached screenshot under Geoprocessing Options. Add results of geoprocessing operations to the display.
... View more
09-12-2012
05:21 AM
|
0
|
0
|
1165
|
|
POST
|
that's exactly what I'm doing. I use numpy to push cell values of 24 rasters into a dictionary and then populate an in_memory point FC which is then appended. I end up with a point w/ the values of the 24 rasters. Everything is really fast up until the append. The in_memory point fc takes no time. So you have a preexisting point feature class you want to add data from your rasters you are extracting data from? Maybe an insert cursor? You could load that directly from your dictionary, no need to create a temporary fc at all.
... View more
09-11-2012
09:37 AM
|
0
|
0
|
3807
|
|
POST
|
I would imagine the one merge would be faster. Do you need to keep the output point feature classes from the raster, or is all you are interested in the final output of the merged/appended feature class? If you do not need to keep the intermediate data I would export them to an in_memory workspace which should speed processing time regarldess of the tool you choose. If you want to get real crazy efficient you can extract the x,y,z,m values for each raster cell and store them in a csv or dictionary and create a point layer out of that. You'd have to manage your memory pretty well if you are processing 95 x 1 million records.
... View more
09-11-2012
09:29 AM
|
0
|
0
|
3807
|
|
POST
|
But will Tkinter be packaged with the add-in when I distribute it? I distribute my add-ins to other people and I don't want them to have to install additional libraries/interfaces such as Tkinter (and in some cases they aren't allowed to). Tkinter is a standard library, anyone with Python installed will have access to it. Is there a way to use arcpy parameter like you would in a python toolbox? Input parameters should be able to be handled the exact same way as a python toolbox.
... View more
09-11-2012
08:55 AM
|
0
|
0
|
2706
|
|
POST
|
[ATTACH=CONFIG]17604[/ATTACH] I would like to be able to get same selection of first row by using either job_num or job_num2 using single input box. I'm not sure what you are doing since you will never be able to select one row with any query unless you reference a unique ID, which it seems neither job_num nor job_num2 are. If there are values that are the same between the two columns but do not match the same row this would be even more challenging to implement in a single parameter. If there are no numbers that match between the columns and you just want a number inputted to return any result from those three columns that match, try this as your query. query = "{1} = '{0}' or {2} = '{0}' or {3} = '{0}'".format(job_num, "Job_Num", "Job_Num2", "Job_Num3")
... View more
09-11-2012
08:45 AM
|
0
|
0
|
1299
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 05-17-2011 10:36 AM | |
| 1 | 08-16-2012 10:48 AM | |
| 1 | 10-31-2012 08:39 AM | |
| 1 | 07-16-2012 01:52 PM | |
| 1 | 03-15-2012 10:57 AM |
| Online Status |
Offline
|
| Date Last Visited |
08-22-2024
11:12 PM
|