POST
|
Since nobody can reproduce the Problem, I assume it's somekind of setting or maybe bug in the Version of Pro my organization is using. I will use the workaround to delete all the fc in memory one by one for now. Thanks for all the help and testing
... View more
04-07-2020
01:08 AM
|
0
|
0
|
1602
|
POST
|
I am running 2.4.3. Since nobody else can reproduce the behavior, I will resort to the workaround of deleting everything one by one for now.
... View more
04-07-2020
01:06 AM
|
0
|
0
|
8368
|
POST
|
It works in IPython sys.executable
'C:\\Program Files\\ArcGIS\\Pro\\bin\\Python\\envs\\arcgispro-py3\\python.exe' but the same result in ArcGIS, Python window or Toolbox sys.executable
'C:\\Program Files\\ArcGIS\\Pro\\bin\\ArcGISPro.exe'
... View more
04-06-2020
07:42 AM
|
1
|
2
|
8368
|
POST
|
arcpy.AddMessage(arcpy.Exists(r"memory\copied"))
arcpy.CopyFeatures_management("to_copy", "memory\copied")
arcpy.AddMessage(arcpy.Exists(r"memory\copied"))
arcpy.Delete_management("memory")
arcpy.AddMessage(arcpy.Exists(r"memory\copied"))
Output is False, True, True the first time the script runs, True True True the second time and onwards So line 4 doesn't do anything, and even after the Tool finished, fc in memory persist. Replacing line 4 with the specific delete-call: arcpy.Delete_management(r"memory\copied")
gives the expected result of False, True, False for any number of runs If I use the older "in_memory" it works fine by the way. arcpy.AddMessage(arcpy.Exists(r"in_memory\copied"))
arcpy.CopyFeatures_management("to_copy", "in_memory\copied")
arcpy.AddMessage(arcpy.Exists(r"in_memory\copied"))
arcpy.Delete_management("in_memory")
arcpy.AddMessage(arcpy.Exists(r"in_memory\copied")) Output is: False, True, False And even if I remove line 4 and 5 the output is False, True for any number of runs. So the temporary fc saved in_memory are not kept in between runs.
... View more
04-06-2020
02:23 AM
|
2
|
2
|
8368
|
POST
|
Sorry, but somehow your anwser makes me wonder if I asked my question the right way. 1. My tool shows unexpected behavior when I use what I believed to be the memory-workspace (arcpy.env.workspace = "in_memory"/"memory") 2. You say that I am not using the memory-workspace, but rather a file gdb and the issues might be related to either that or some environment variables. 3. I ask (intended to) ask about the proper way to save to memory-workspace 4. You explain how to save the final result. So, apparently I made a mistake with one of the questions, sorry for that. To rephrase the issue. I have a Toolbox, that does a lot of stuff like clipping, dissolving, union, create contours, calc geometries, etc. etc. The Toolbox is primarily used to enable non-GIS experts to calculate complex results and ensure comparibility of the results. 95% of the results created during runtime are just intermediat steps and not needed, meaning I'd like to have them in a temporary Location. Since they are created by standard ArcGIS GP-tools like Clip or Union, I thought the memory-workspace would be the ideal solution. (Quoting from the offical documentation paqe: so it is an ideal location to write intermediate data created in a ModelBuilder model or Python script. Now, it seems like I misunderstood something essential about how to use the memory-workspace (or I misunderstood your first anwser), so let me ask again. Is it possible to set the env.workspace to a memory-workspace? Do I need to set the location for each output that I want to be temporary manually to the memory-workspace? (i.e. r"memory\tmp_out") Sorry for the long text, with the somehow unrelated seeming questions, but without a clear understanding about how to save temporary results, I don't think I can try your proposed solutions for the actual question. Cheers
... View more
04-03-2020
05:24 AM
|
0
|
1
|
687
|
POST
|
Thanks, I Always understood the Paragraph with you cited as refering to using memory workspaces for everyday work. So if I have a script like: 1. arcpy.Clip_analysis("to_clip_1", "clipping", "tmp_1")
2. arcpy.lCip_analysis("to_clip_2", "clipping", "tmp_2")
3. arcpy.Dissolve_management("tmp_1", "tmp_2", "Output_to_folder") where the tmp-results are supposed to be in the memory workspace, and the output in some folder or gdb, do I need to specify it like this?
1. arcpy.env.workspace = path_for_output
2. arcpy.Clip_analysis("to_clip_1", "clipping", r"memory\tmp_1")
3. arcpy.Clip_analysis("to_clip_2", "clipping", r"memory\tmp_2")
4. arcpy.Dissolve_management("tmp_1", "tmp_2", "Output_to_folder") If arcpy.env.workspace = "memory" sets the Workspace to some file gdb, where is this file gdb located? When I describe a fc and print the catalogPath, the output is just "memory\fc". I will try your suggestion for the specific script, once I am sure that I got it right and will report on the results. Cheers
... View more
04-03-2020
01:31 AM
|
0
|
3
|
687
|
POST
|
Hello, how can I delete the memory-workspace after a script has run? I usually added arcpy.Delete_management("memory") to the end of my scripts, but noticed yesterday that this apparently doesn't do anything. The workaround i found is to loop over all fc in the workspace and delete them one by one. for fc in arcpy.ListFeatureClasses():
desc = arcpy.Describe(fc)
arcpy.Delete_management(desc.catalogPath) But this help site indicates it should be possible to delete all at once. Write geoprocessing output to memory—ArcGIS Pro | Documentation Also, the older in_memory seems to empty itself after a script ran, why doesn't memory do the same? Cheers edit: I am using ArcGIS Pro 2.4.3
... View more
04-02-2020
11:25 PM
|
1
|
17
|
10361
|
POST
|
Hello, i have a script for ArcGIS Pro (2.4.3) which essentially does this: 1. arcpy.env.workspace = "in_memory"
2. arcpy.CopyFeatures_management("fc", "copy")
3. Stuff with copy
4. arcpy.Contour_3d("dem", "contour_lines", 10)
5. More Stuff with copy While the stuff in before Contour_3d works fine, the code after throws an exception, that "copy" doesn't exist. After some testing, it seems, that contour_3d makes arcpy somehow 'forget' where to look for fc. I used Describe to find out, what was going on, and couldn't find any of the fc that where used and created during run anymore, including the just created "contour_lines". What I noticed was, that doing anything not fc-related with the workspace fixed the issue. arcpy.AddMessage(arcpy.env.workspace)
arcpy.AddMessage(arcpy.ListFeatureClasses())
arcpy.env.workspace = "in_memory" All of those made the rest of the script work like a charm. Another interesting Issue I noticed while searching for the error, is the interaction between Contour_3d and the new memory-workspace. The reason I used the old in_memory-workspace was, that I created the dem with arcpy.MakeImageServerLayer_management() (which doesn't work with the new memory-workspace). So, thinking the problem might lie within in_memory, I replaced in_memory with memory and used some pre-created dem instead. So, strangly enough, the first error I got was: ERROR 000880: Output feature class: 's extension is empty for the output feature class. And I had to fix ".shp" to the name of the fc ("contour_lines.shp"), which surprised me, since I can't usually create fc with Extension in the memory-workspace. Just to be sure I tried some other functions, all of which threw the expected Error: ERROR 000354: The name contains invalid characters Next strange thing is, running the tool a second time got me this Error: ERROR 000287: Fail to create output feature class. Apparently Contour_3d can't overwrite it's output. (why does the memory result even persist between script runs?) Oh. and the first Problem wasn't fixed by changing to the new version neither. So what is going on with Contour_3d, it seems like some serious Bugs to me, or am I doing something completly wrong? Cheers
... View more
04-02-2020
11:08 PM
|
0
|
5
|
739
|
POST
|
Hi, I have several questions to task functionallity that I find quite basic, but can't seem to find. 1. The option to save edits: I want my users to edit a polygon if necessary (which happens in maybe 50% of the cases). To run the following steps it's necessary to save these edits. The solution for this seems to be a hidden, auto-run step which saves the edits. However, this results in a error when no edits where made, as the option to save Edits is not available. Is the only option in this case to force the user to manually save edits if they made some? Since the whole task freezes up when the edits are not saved (i.e. forgotten), this would invite a lot of frustration i think. 2. I haven't been able to select features at the beginning of a step, that were created via geoprocessing Tools. Neither 'Features created in this task' nor 'modified in this task seem to work. This is particularly confusing since setting the visibility, selectebility etc for the same features works like a charm. 3. Verifying feature created by geoprocessing tools: I want the user to enter a value for a (during the task created) field for (the same as in 2.) feature that has been created by a geoprocessing tool. The verification is: If the number of elements without a value is greater than 0. This results in an error everytime, even if the value has been entered for sure (also tested with select by attribute afterwards). I am guessing this has to do with the unability to select the element automatically. I really love the concept of tasks, but stumbling over these problems, I am always wondering if I am just too dumb for it or if they are just really badly designed. Why try to save edits that haven't been made? Why allow the use of geoprocessing Tools when they work with only half of the task functionallity? As I said, there might be simple solutions, that I just don't know about. I also cant find any tutorials apart from a couple of introductionary videos by ESRI on YouTube. Cheers, Matthias
... View more
05-23-2019
04:09 AM
|
0
|
0
|
535
|
POST
|
Thanks for the quick Reply, even if it's not the answer I was hoping for. I guess I will create a demo-Task with manual run/auto proceed for now and get some feedback if thats OK.
... View more
04-12-2019
01:36 AM
|
0
|
0
|
308
|
POST
|
Hello everyone, I am currently building a tool (with Python) that will eventually allow the user to do some Basic precipitation-runoff modeling. My employer originally wanted a single Toolbox that combines all steps, but the Code for that would be huge and quite complex. Since preparing the model consists of some pretty simple and repetitve steps, so I thought tasks could be a better solution. This would also increase the comprehensibility of the process and make it possible to split the code in severel tools, that can be maintained more easily. Trying it out tentatively yesterday I unfortunetly hit a roadblock pretty much right away. One of the first steps in the process is to select the modelling area. The intendet Input of this is a county wide layer of subbasins, additionally a river Network can be used for orientation, but is not needed. The current workflow intends the user to select all subbasins for which he will eventually want to get results. The upstream areas are then selected according to the structure of the data (see Picture (I saved the usually only selected areas for better visualization)). The Problem I have comes after this step, I want to test if the any of the selected areas are over a certain size (limited by the modeling approach). At first I tried to do this with the inbuild verification options, which didn't work. So I build a simple Python Toolbox that does the checks and which i would like to run in a (hidden) step after the selection. The Problem is, that it doesnt return/show any results unless its set to 'manual', in which case it will at least Show the 'run script' information + errors The question now: is there a way to return the results of the toolbox when the step runs on auto(/is hidden)? Or is there another/better approach for the problem, or are tasks even the right tool for the Job? Thanks in advance for any help, Matthias PS: since is my first question here, i probably described the problem in too much detail, sorry for that PPS: i hope I posted at the right Location
... View more
04-10-2019
11:34 PM
|
0
|
2
|
398
|
Title | Kudos | Posted |
---|---|---|
1 | 04-06-2020 07:42 AM | |
2 | 04-06-2020 02:23 AM | |
1 | 04-02-2020 11:25 PM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|