|
POST
|
Hi. That type of button is called a Split Button, and can be created with the ArcGIS Pro SDK template. You can find more information about the split-button and the other types of buttons on the ArcGIS Pro SDK wiki. Unfortunately I don't any pages or sites where you can see a graphical display of each kind of button and other user interface elements.
... View more
06-22-2023
03:05 AM
|
1
|
0
|
2018
|
|
POST
|
I've been working on a add-in, which works ok in Pro. I'm quite new to regression testing / unit testing, but I'd like to try it on this new add-in. I've followed the steps in the ProGuide Regression Testing, but I get an error when trying to run the tests. The error says: Class Initialization method UnitTest.LayoutTest.ClassInitialize threw exception. System.AggregateException: System.AggregateException: One or more errors occurred. (Object reference not set to an instance of an object.) ---> System.NullReferenceException: Object reference not set to an instance of an object.. When trying to debug the test, I see that the error originates at the startApplication-method of the class TestEnvironment. The message says: System.DllNotFoundException: 'Unable to load DLL 'DADFLib.dll' or one of its dependencies: The the specified module could not be found Does anyone know what might be wrong here?
... View more
06-21-2023
06:06 AM
|
0
|
2
|
1413
|
|
POST
|
Hi. I'm working on an add-in which creates several layout-elements, including a groupelement which contains some text and a scalebar. I'm able to add background / outline for each of the elements in the group, but not on the group itself. How do I do this? I can't see any methods or properties on the GroupElement-object, nor the CIM-definition. Here's how I've created the GroupElement. ElementInfo info = new ElementInfo();
info.CornerRounding = 25;
GroupElement groupElement = ElementFactory.Instance.CreateGroupElement(
elementContainer: Module1.layout,
elements: elementList,
elementName: "JSRMålestokkGruppe",
groupElementInfo: info
); Can anyone help me with this and point me in the right direction?
... View more
06-05-2023
01:28 AM
|
0
|
1
|
1002
|
|
POST
|
Hi. I'm trying to change the symbology of one of my layers in a python script. I've found the given layer # Get layer "Vegteig" from active map
aprx = arcpy.mp.ArcGISProject("CURRENT")
m = aprx.activeMap
fl_vegteig = m.listLayers("Vegteiger")[0] Then I'm trying to define a new UniqueValueRenderer for the layer: symb = fl_vegteig.symbology
symb.updateRenderer("UniqueValueRenderer")
symb.renderer.fields = ['TILKNYTTET'] When I try to run this, I get this error: The attribute 'fields' is not supported on this instance of UniqueValueRenderer Does anyone know what might be wrong? I'm using almost the same code in another script (same toolbox), which works perfectly.
... View more
05-09-2023
06:20 AM
|
2
|
10
|
2984
|
|
POST
|
Hi. I'm working on creating several ArcGIS Pro Tasks for my organizations users, and would really appreciate some input on a subject. One of the tasks involved a step where the user edits / creates one or more polygons, and in the next step the edited featureclass is used in a intersect with another given class. The result is then supposed to be used in a later task-step. The featureclass that's being edited and the result is in the same filegeodatabase. When I first created this task, I went through all of the steps and defined the contents (visibility, selectability, editability etc) for each step. So far, so good. But when distributing the task to a testuser through a project template, I ran into a problem with the result-layer. As the resultlayer does not exist when starting the task, the layer is listed as a broken resource. After running the intersect-task, the layer is added to the map, but the layer is still listed as a broken resource and will not respect any of the visibility, selectability I defined when creating the task. What I've done so far is to add the result featurelayer to the filegeodatabase template, and to the map. At the start of the task, this is an empty featureclass. In the intersect-task, I've created a pythonscript that runs the intersection and writes the result to a "memory"-class, before inserting the results into the real result-featureclass using arcpy.da.InsertCursor. This works fine. What would be the best practice dealing with this? Have anyone done anything similar with tasks?
... View more
05-09-2023
12:19 AM
|
1
|
1
|
861
|
|
POST
|
Just wanted to say that I get the same kind of error in ArcGIS Pro 3.0.3 as well. I have a python toolbox with several python scripts in this folder structure (the pyt references the scripts in the Scripts folder): - OwnershipCalculation -- OvershipCalculation.pyt -- Scripts ---- Calculation.py ---- ExportResults.py When consolidating the toolbox, the Scripts folder is put inside a new folder with the same name as the parent folder: - OwnershipCalculation -- OvershipCalculation.pyt -- OwnershipCalculation ----Scripts ------ Calculation.py ------ ExportResults.py While the .pyt still references the old path.
... View more
04-18-2023
03:02 AM
|
0
|
0
|
961
|
|
POST
|
I just tried using string instead of layer in the ApplySymbologyFromLayer() function, and the results are the same. No errors returned, and the layer symbology does not change..
... View more
03-31-2023
12:56 AM
|
0
|
0
|
10496
|
|
POST
|
Hi. I've created a pythonscript contained in an ArcGIS Pro Toolbox (atbx), where I'd like to change a layer's symbology. I know it's possible to define a layer's symbology through the script parameters in the toolbox by setting the output layer as derived and also defining a lyrx file either as a property ofthe parameter or in the script it self. But in my case, the layer that I want to change symbology for is already added in the ArcGIS Pro project and is being used in a task. Therefore it's not possible for me to remove and add the layer as a derived parameter, since the task-resource for that layer will be broken. I've tried using arcpy.ApplySymbologyFromLayer, but that doesn't work. There are no errors, but the layer symbology does not change. The lyrx-file works when importing symbology manually in Pro. What's the best practice here? Does anyone know what might be causing ApplySymbologyFromLayer to not have any effect? One option is to define the new symbology based on the CIM-class, for example CIMUniqueValueRenderer. I've almost created the symbology this way, but I'm not able to set the defaultLabel. The symbology should show only to groups, <Null> and "All other Values". Has anyone got any experience with this?
... View more
03-30-2023
08:09 AM
|
1
|
6
|
10555
|
|
POST
|
Hi. I've created a ArcGIS Pro Task containing about ten tasks and subsequent steps. Some of the steps runs a Python Toolbox, where some scripts creates new feature classes and adds it to them to the map, to be processed in the task-steps. When creating the task, I've set specified which of the featurelayers that should be editable, selectable etc, for each task step (content). I've exported my task to a task-file. If I import the task-file into another ArcGIS Pro project, which uses another filegeodatabase, but with the same datastructure as my original, many of the resources are broken. How can I resolve this? I thought that the same task could be used for the same workflow, even if the datasource changes. I can of course repair each of the broken resources manually, but that won't be possible when I distribute the task to the users. Could a repair like this be done through python?
... View more
03-24-2023
08:21 AM
|
0
|
1
|
916
|
|
POST
|
Hi. I've created an ArcGIS Pro template containing av Python Toolbox. The toolbox contains several scripts in individual .py files. I've created the ArcGIS Pro template with both "Share outside of organization" and "Include Toolboxes" checked. When I create a new ArcGIS Pro project based on the template, everything seems to be created as expected (map, layout and toolbox), but the python toolbox does not work. The problem is that the folder containing the scriptfiles is moved into a folder which has the name of the original folder.. My toolbox contains all of the .py's in a folder called Scriptene: After the new project is created based on the template, the folder Scriptene is now placed inside another folder called Geodata. This breaks the toolbox in the newly created project, since the python toolbox imports the scripts directly from Scriptene. Is this a known feature of using the project template so that I need to change my toolbox, or is there something wrong (which is my guess)?
... View more
03-17-2023
02:35 AM
|
3
|
1
|
987
|
|
POST
|
Hi. To do the task that you describe, you need to create a pythonscript that finds all the lyrx files in the directory, then create a featurelayer and get the number of features of that layer. There are several options for getting the layerfiles, using the modules os, glob or pathlib (from Python 3.4). This example uses the glob-module import glob
folder = r'C:\Maps\LayerFiles\*.lyrx' # your folder with lyrx
elements = glob.glob(folder) #get the files Then you need to iterate each of the files, create a featurelayer and get the number of features: for element in elements:
featurelayer = "FeatureLayer"
arcpy.MakeFeatureLayer_management(in_features=element, out_layer=featurelayer) # create featurelayer from element
c = arcpy.GetCount_management(featurelayer) # get count of features
arcpy.Delete_management(in_data=featurelayer) # delete featurelayer For sending the e-mail, you need to use the smtp-library, and call the sendEmail method each time the count is greater than 0. You can see the use of the smtplib here: import smtplib
def sendEmail(layername):
sender = 'from@fromdomain.com'
receivers = ['to@todomain.com']
message = """From: From Person <from@fromdomain.com>
To: To Person <to@todomain.com>
Subject: Issues found in {0}
Records where found in the {0} query. Please investigate""".format(layername)
try:
smtpObj = smtplib.SMTP('localhost')
smtpObj.sendmail(sender, receivers, message)
print "Successfully sent email"
except SMTPException:
print "Error: unable to send email" Good luck 🙂
... View more
03-13-2023
06:30 AM
|
1
|
0
|
1509
|
|
POST
|
I finally got something working here. In my scripts-folder, I forgot to add a __init__.py file. When adding this file, and changing my imports like this, then it started working. geovegModules = ['Scripts.AndelerTilExcelTool',
'Scripts.BearbeidAR5Tool',
'Scripts.BearbeidBygningerTool',
'Scripts.BeregnAndelerTool']
for module in geovegModules:
if module in sys.modules:
del(sys.modules[module])
from Scripts.AndelerTilExcelTool import AndelerTilExcel
from Scripts.BearbeidAR5Tool import BearbeidAR5
from Scripts.BearbeidBygningerTool import BearbeidBygninger
from Scripts.BeregnAndelerTool import BeregnAndeler But there's still one problem. I'm trying to define a logging handler in my toolbox (in class Toolbox __init__(self): handler = logging.FileHandler(filename=r'C:\temp\Geoveg.log')
formatter = logging.Formatter('%(asctime)s %(name)s %(levelname)s %(message)s')
handler.setFormatter(formatter)
handler.setLevel(logging.DEBUG)
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
logger.handlers = [handler] When trying to consolidate this, I get an FileNotFoundError. [Errno 2] No such file or directory: 'C:\\commondata\\temp\\Geoveg.log'
... View more
03-13-2023
01:35 AM
|
0
|
0
|
1595
|
|
POST
|
@JerryClark4 I've used Python 3.x since the toolbox is for use in ArcGIS Pro 🙂
... View more
03-09-2023
11:24 PM
|
0
|
0
|
1603
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 05-27-2025 05:20 AM | |
| 1 | 01-17-2023 03:13 AM | |
| 1 | 01-17-2023 11:45 PM | |
| 1 | 03-30-2023 08:09 AM | |
| 1 | 08-23-2024 05:01 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-03-2025
01:23 AM
|