IDEA
|
Kory, were you trying to point me to something specific in the Pro SDK space? Your link just resolves to the top-level of the Pro SDK space.
... View more
01-03-2018
11:05 AM
|
0
|
1
|
869
|
IDEA
|
ArcGIS Pro supports automatically installing and checking for updates for Pro Addins located at a given UNC Path via its 'Addin Folders' settings key (https://github.com/Esri/arcgis-pro-sdk/wiki/ArcGIS-Pro-Registry-Keys). This is great and has worked out perfectly well for a very long time. However, as more organizations shift towards the cloud and start to phase our their use of 'Shared Folders' via UNC Paths, alternative solutions will be needed to continue to provide this functionality. I would like to be able to reference a GitHub release URI for a Pro Addin in this Registry Key. By doing this, once we issue a release on Git, we could upload the binary *.esriaddin file as a release asset once we've built the solution. The URI for the Registry Key would be something like: https://github.com/Esri/arcgis-pro-sdk-community-samples/releases/latest Given that URI, Pro would need to then find the *.esriaddin file using GitHub's Release API and could then download and install the release automagically. An alternative more simplistic solution might be to simply allow us to specify static URI links, which would have the benefit of allowing developers to store their binary release files on cloud drive solutions like s3 buckets, OneDrive, Dropbox, etc. As long as the link doesn't change and it resolves to the *.esriaddin file, it should *just work*. GitHub request aside, the static URI link is not really any different from the current workflow except that you would be downloading the solution over HTTP instead of copying the solution via UNC.
... View more
12-27-2017
08:59 AM
|
4
|
4
|
6710
|
POST
|
Are there any chef scripts, amis or recommendations for running ArcGIS License Manager in AWS? We have a requirement to move everything to AWS but also need to support ArcGIS Desktop licensing from License Manager. ArcGIS Pro can be licensed from Portal, but no such luck for ArcGIS Desktop (ArcMap, ArcCatalog, etc). It's such a tiny footprint that I'd hate to have to run even a t2 instance just for License Manager. It'd be great if it were possible to license ArcGIS Desktop via a lamba function or just do it from Portal. Any ideas?
... View more
12-13-2017
08:56 AM
|
0
|
8
|
4232
|
POST
|
Thanks RJ. Good to know that it's only caching the update key data. As for the SOIs, that's what the existing solution does now - but we really want to support Hosted Services and it's not possible to configure an SOI on a hosted service so we're looking for a way to deliver similar functionality for both hosted and federated services. It would be nice however, it there was a way for to build a GeoEvent service that could "subscribe to a service's endpoints". Now that we know GeoEvent can't solve the problem, we're thinking about trying to spoof a Hosted Feature Service using an AWS Lamba function which we would then register with our Portal, then using that spoofed feature service as a proxy for the actual feature service we want to intercept calls to and do some pre/post processing.
... View more
12-05-2017
12:25 PM
|
0
|
0
|
889
|
POST
|
According to this post by RJ Sunderman, when you Poll ArcGIS Server for Features and use the Get Incremental Updates method, the input will maintain an in-memory cache. Is there anyway to query this cache to determine what the underlying deltas are? In my case, I want to create a GeoEvent service that will poll a Feature Service for updates every 5 minutes. When it determines that updates have been made to the service (one or more features have been added, one or more features have been edited, or some combination of the two), I want it to actually compare the returned features to its in-memory cache and compile the actual changes so that they can be written as a new feature to a "Change-Log" feature service. If there is not a way to query that in-memory cache (which is my expectation), is there another way for us to determine what the nature of the changes are? We want very granular tracking of every single change made to certain services. We explored using SOIs for this and that was successful to an extent, but the lack of support for Hosted Services has become a show stopper since we're trying very hard to move away from Federated Services.
... View more
12-04-2017
07:52 AM
|
0
|
2
|
1174
|
POST
|
Does anyone have an example of what the addField method in the FieldInfo class does? The documentation on it is not particularly helpful. I was wondering if it might be a very efficient method to add a field to a feature layer.
... View more
10-27-2017
07:00 AM
|
0
|
2
|
932
|
POST
|
Maybe I'm missing something but that doesn't explain why parameters[0].valueAsText would return just the first character. You can see how the list is being created. It's a static list. There's no reason I should have to slice it. Having to slice the list would make the purpose of the valueAsText property meaningless since I'd never be able to determine the currently selected value from the ValueList
... View more
10-20-2017
12:35 PM
|
0
|
3
|
2497
|
POST
|
Tried that about an hour ago. 'list' object has no attribute 'valueAsText'
... View more
10-20-2017
12:19 PM
|
0
|
5
|
2497
|
POST
|
I was slapping together a toolbox tool today and came across an interesting issue. import arcpy
class Toolbox(object):
def __init__(self):
"""Define the toolbox (the name of the toolbox is the name of the
.pyt file)."""
self.label = "Toolbox"
self.alias = ""
# List of tool classes associated with this toolbox
self.tools = [Tool]
class Tool(object):
def __init__(self):
"""Define the tool (tool name is the name of the class)."""
self.label = "Tool"
self.description = ""
self.canRunInBackground = False
def MessageBox(self, Title, Message, ButtonStyle=0, MessageboxType="NOICON"):
"""
Raises a system-modal messagebox with the given title and message
with the specified ButtonStyle and MessageboxType. Used to raise
messageboxes from a Python Toolbox tool operating on a Background Thread.
INPUTS:
Title (String)
Title of the messagebox
Message (String)
Message to be displayed in the messagebox
ButtonStyle (Integer)
Value: Buttons Shown:
0 OK (Default)
1 OK | Cancel
2 Abort | Retry | Ignore
3 Yes | No | Cancel
4 Yes | No
5 Retry | No
6 Cancel | Try Again | Continue
MessageboxType (String)
Value: Description:
NOICON No icon is displayed in the Messagebox
INFO An Information Icon is displayed
QUESTION A Question Mark Icon is displayed
WARNING A Warning Icon is displayed
ERROR An Error Icon is displayed
OUTPUTS:
Button Clicked (Integer)
Value returned indicates the buttonpressed by the user
Return Value Button Pressed
1 OK
2 Cancel
3 Abort
4 Retry
5 Ignore
6 Yes
7 No
10 Try Again
11 Continue
"""
if MessageboxType == "NOICON":
MB_STYLE = 0x00
elif MessageboxType == "INFO":
MB_STYLE = 0x40
elif MessageboxType == "QUESTION":
MB_STYLE = 0x20
elif MessageboxType == "WARNING":
MB_STYLE = 0x30
elif MessageboxType == "ERROR":
MB_STYLE = 0x10
else:
raise Exception("Invalid 'MessageboxType' value")
if ButtonStyle not in range(0, 7):
raise Exception("Invalid 'ButtonStyle' value")
import ctypes
buttonPressed = ctypes.windll.user32.MessageBoxA(0
, Message
, Title
, ButtonStyle | MB_STYLE | 0x40000)
return buttonPressed
def getParameterInfo(self):
"""Define parameter definitions"""
param0 = arcpy.Parameter(
displayName="Input Features",
name="in_features",
datatype="GPString",
parameterType="Required",
direction="Input")
param0.filter.type="ValueList"
param0.filter.list=["Butter", "Milk", "Bread"]
params = [param0]
return params
def isLicensed(self):
"""Set whether tool is licensed to execute."""
return True
def updateParameters(self, parameters):
"""Modify the values and properties of parameters before internal
validation is performed. This method is called whenever a parameter
has been changed."""
if parameters[0].value:
self.MessageBox("Selected Parameter", parameters[0].valueAsText)
return
def updateMessages(self, parameters):
"""Modify the messages created by internal validation for each tool
parameter. This method is called after internal validation."""
return
def execute(self, parameters, messages):
"""The source code of the tool."""
arcpy.AddMessage("Parameter 0: " + parameters[0].valueAsText)
return
There's nothing crazy going on here. Only thing out of the ordinary is that MessageBox function. Here's the weird thing. My updateParameters function has some logic to raise a Messagebox that displays the value selected by the user in param0. Works fine except that for some reason, the value is being sliced - I'm only getting the first letter of the selected parameter. I also added an AddMessage function to the execute function to print the selected parameter to the Results Window. That actually gives me the full value, so perhaps it is my Messagebox function that is slicing it but I don't think so. Anyone have any insight?
... View more
10-20-2017
12:03 PM
|
0
|
8
|
4095
|
POST
|
That could be an option. I'm not sure how it would perform though given that our internal network is absolute garbage. In any case, once I implemented the custom function I had defined in the updateMessages section of my toolbox - for some reason that is not clear to me, the result is almost instantaneous. Must faster than the 6 seconds I was getting back when running this in the Python Window. Pretty much every answer on this post is correct though. Which one to mark correct? I suppose I'll defer to the Dan the Man ( Dan Patterson ) to pick the best answer. On a side note - why would a Python Toolbox be able to run that function so much faster than the Python Window? I get that Python Toolboxes can be background enabled (which this one is), allowing them to run in a separate, 64-bit thread - but the performance difference is so dramatic (I seriously mean that the error is raised within 1 second) that I feel like there has to be something else going on that I just don't know about.
... View more
10-17-2017
08:58 AM
|
0
|
1
|
206
|
POST
|
Would be nice if there were a Describe property for record count. That would be fast. Seems strange to me that there's not. FIDSet on a layer will return selected records, but you have to set up a cursor and iterate the dataset just to get the full count.
... View more
10-17-2017
07:43 AM
|
0
|
3
|
838
|
POST
|
Good points. The slowest part is mostly likely setting up the cursor and there's not going to be a way around that. The laws of diminishing returns are certainly something to think about here. If I can't get it shrunk down by lunch, I'll probably just take the most efficient code outlined above and use it at runtime and throw an error if the field is not unique.
... View more
10-17-2017
07:26 AM
|
0
|
1
|
838
|
POST
|
I benchmarked GetCount_management v the function I defined above. Results below. My custom function was just a little faster but it wouldn't surprise me to find that GetCount_management were faster against a much larger dataset. I'm currently testing against a dataset with a record count of 465,051 as that's the biggest one I have on my system. >>> calculateRunTime(arcpy.GetCount_management
, parameters[2].valueAsText)
(7.444000005722046, <Result '465051'>)
>>> calculateRunTime(isUniqueValueField
, parameters[2].valueAsText
, parameters[3].valueAsText)
(6.894999980926514, True) However, my custom function also does more than just count the rows. In addition, it compares the record count to the number of unique values in the given field, returning True or False to indicate whether or not the number of unique values in the field matches the total record count (see logic for calculateRunTime and inUniqueValueField functions in previous post). That's really what I'm after. Figuring out if the values in the given field are unique for every record. I also tried the logic you outlined above, which is much more elegant than mine. def unique_check_defdict(iterable):
d = collections.defaultdict(int)
for i in iterable:
if d[i] > 0:
return False
d[i] += 1
else:
return True
def isUniqueValueField_byBixby(fc, field):
with arcpy.da.SearchCursor(fc, field) as cur:
print unique_check_defdict(i for i, in cur)
>>> calculateRunTime(isUniqueValueField_byBixby
, parameters[2].valueAsText
, parameters[3].valueAsText)
True
(7.770999908447266, None)
Since this function is going to execute in a Python toolbox tool under the updateMessages function for the tool - essentially validation, I need it to be as fast as I can possibly get it. GetCount_management might be fast at scale, but if a user throws a smaller dataset at it - waiting almost 8 seconds for validation is probably going to be suboptimal. I could take this out of the updateMessages function and put it into the runtime execution logic then throw a runtime error if the values aren't unique but I'm trying to avoid doing that. I'm going to play with numpy today and see if that can get me toward my goal of getting this down to 3 seconds or less against approx. half a million records. FYI - I really appreciate the help from everyone. If you can think of other ways to optimize or make it go zoom, zoom, please share!
... View more
10-17-2017
07:03 AM
|
0
|
3
|
838
|
POST
|
GetCount_management is a no-go because it has to instantiate the geoprocessor. Big performance hit. Not a good thing to do in Python Toolbox parameter validation unless you like making your users watch the cursor spin.
... View more
10-16-2017
02:12 PM
|
0
|
6
|
838
|
Title | Kudos | Posted |
---|---|---|
1 | 06-11-2015 12:02 PM | |
2 | 02-04-2016 02:35 PM | |
1 | 04-11-2017 12:51 PM | |
1 | 08-07-2015 11:00 AM | |
4 | 06-19-2015 01:44 PM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|