POST
|
I've done some additional testing and parts of the tool work in different places. I copied and pasted the snippet from the toolbox history into various places only changing a limited amount of code. A direct copy python snippet and paste to the Python window works fine. Since I can't just reference a map using the string name outside of the Python window I added: aprx = arcpy.mp.ArcGISProject("CURRENT") #Use full path when running in .py mp = aprx.listMaps("Map")[0] arcpy.env.overwriteOutput = True I then use mp as the input_map parameter rather than the string of the map name. Pro Python Window: Everything works as expected. Annotation featureclass is created, labeling is disabled, and annotation layer is added to the map. This includes running with input_map=mp rather than the string of the map name. Python Toolbox (.pyt): Annotation featureclass is created in the FGDB, however feature labeling is still enabled and the annotation layer does not get added to the map. Python outside Pro (.py): Annotation featureclass is created in the FGDB, feature labeling is disabled, however the annotation layer is not added to the map. This seems like more of a bug than an enhancement. I'm not trying to manipulate the annotation at all, just simply get it added to the map. It functions to different degrees depending on where it is running.
... View more
3 weeks ago
|
0
|
1
|
88
|
POST
|
I gave this a try and it made no difference. I've also tried (before and after this suggestion) running the tool with and without an existing annotation layer. I'm preferring annotation here but I have also tried the same with graphics and it does not create graphics. It does leave the labeling turned on for the layers, which would normally be turned off once the annotation tool finishes. Thanks
... View more
3 weeks ago
|
0
|
1
|
118
|
POST
|
I've been working on a Python Toolbox that imports runs through a number of steps the last one being to convert labels to annotation so they can be manually placed (I've tried graphics also). I can run the convert to annotation/graphics tools without issue when I manually run them. I can copy and paste the python code into the .pyt file and it runs with no errors, however it doesn't actually convert to annotation/graphics. If I copy and paste the code to the Python window it runs fine and creates annotation/graphics as expected. I created a new clean pyt with the arcpy.cartography.ConvertLabelsToAnnotation code in the execute section and again it runs without error, but no annotation/graphics are created. This was working in earlier versions of Pro but I'm not sure when it stopped. I'm currently on 3.2.0. Has anyone else had this issue and found a way around it?
... View more
3 weeks ago
|
0
|
5
|
222
|
POST
|
What is the best way to get the current APRX in a Python Toolbox (.pyt) tool? I've found that if I use arcpy.mp.ArcGISProject("CURRENT") then the initial loading of the toolboxes will results in the error below. If I right click on the toolbox and refresh then everything works fine until the next time I close and re-open the APRX. Traceback (most recent call last):
File "<string>", line 100, in __init__
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\_mp.py", line 536, in __init__
self._arc_object = arcgisscripting._mapping.ArcGISProject(*gp_fixargs((aprx_path,), True))
OSError: CURRENT
... View more
09-28-2023
01:12 PM
|
0
|
1
|
251
|
POST
|
I have been trying to update and package a template using Pro 3.1 that includes a couple of .pyt toolboxes. The toolboxes are stored in a different folder but are added to the project. I can run the toolboxes fine but when packaging the template if I choose to include toolboxes it fails almost every time. Randomly sometimes it will work even if I haven't made any changes to the toolbox or project. The only change in the Create Project Template tool that makes any difference is checking/unchecking the Include Toolboxes option. Analyze works every time no matter what. I can copy and paste the path from the error logs and the file is there, path is correct, and it opens in VS code with no problems. If I remove the PYT from the project and instead add it as an attachment it will copy it into the userdata folder with no trouble. It doesn't complain about the other PYT file include in the project, which comes first alphabetically in the catalog but I'm not sure if it just isn't making it that far or not. Below are the lines from the log that indicate the error. I've replaced the filenames with examples, but there are no spaces or special characters other than underscores. Sometimes it does package successfully with no changes to the paths or filenames. Has anyone else had this issue or know of a fix? D:\PATH\PROJECT.aptx 131 ProjectPackage 2023-09-27 12:43:37 Status: Failed ErrorMessage: ERROR 000229: Cannot open D:\TOOLBOX_PATH\TOOLBOX_NAME.pyt
D:\PATH\PROJECT.aptx 131 ProjectPackage 2023-09-27 12:43:39 Status: Failed ErrorMessage: Failed to package.
... View more
09-27-2023
12:59 PM
|
0
|
0
|
258
|
POST
|
I've started noticing an issue where some layers that work fine in the webmap do not load in the operations dashboard web app, has anyone else noticed this? I create a webmap and add a FeatureServer layer to the map. Set extents, save the map everything works. I create an Operations Dashboard web app from the webmap and the layer no longer loads. I thought I had narrowed it to the fact that the dashboard generated geometry query parameter did not include the "latestWkid" parameter, but the webmap generated one did. Other services on the same server however that work in both places do not include the latestWkid parameter. The query generated for the service by the operations dashboard web app fail with the following JSON results: {"error":{"code":400,"message":"Unable to complete operation.","details":["Unable to perform query operation."]}} The service works every time in the webmap and is failing every time in the dashboard. Has anyone else seen this or found a workaround? Thanks, Josh
... View more
07-19-2019
10:27 AM
|
2
|
4
|
1067
|
Title | Kudos | Posted |
---|---|---|
2 | 07-19-2019 10:27 AM |