I need to run a Visibility analysis, which requires a Spatial Analyst license. In ArcObjects, I enable/checkout a license using the IExtensionManagerAdmin and IExtensionConfig interfaces, then call the Visibility method on ISurfaceOp2.
In the ArcGIS Pro SDK, I believe Visibility analysis must be run through the geoprocessing tool, and our administrator enabled a Spatial Analyst license for my Named User license. How would I enable/checkout a license in a Concurrent Use environment? Would ArcGIS Pro check one out automatically as needed? The only functionality I can find right now is to check whether or not a license is available via LicenseInformation.IsAvailable, but I can't find how to actively check one out.
Thanks!
Solved! Go to Solution.
Hi Stephen, this is in the upcoming Pro SDK at 2.2.
Hi Stephen, your understanding is correct:
"Would ArcGIS Pro check one out automatically as needed?"
Yes it would. The licensing behavior of Pro is the same whether it is being exercised via its "COTS" UI or via code in a custom add-in.
Awesome. Thanks!
Hey Charles, can you provide some more clarity on what "automatically checking out" means? I've run the code below through 3 different scenarios:
Scenarios 1 and 2 work fine, but Scenario 3 errors with code 2147483647. What does that code mean? The first line in the code returns that a license is available in all 3 scenarios, even though the UI says the Visibility tool is unavailable in Scenario 3.
My understanding of "automatically check out" is that the the UI will detect that an add-in needs a license, poll the license server, and check one out. Is that correct? If it makes any difference, I'm using a Basic license. This is important functionality because we can't expect our users to remember to check-out and check-in a license every time they want to use our tools.
Debug.WriteLine($"3D Analyst license available: {LicenseInformation.IsAvailable(LicenseCodes.Analyst3D)}");
var progressorSource = new CancelableProgressorSource("Creating visibility raster", "");
var paramDictionary = new Dictionary<string, string>();
paramDictionary.Add("in_raster", elevationRaster);
paramDictionary.Add("in_observer_features", observerLayerName);
paramDictionary.Add("out_raster", rasterPath);
var environments = Geoprocessing.MakeEnvironmentArray(
outputCoordinateSystem: MapView.Active.Map.SpatialReference,
extent: MapView.Active.Extent);
var result = await Geoprocessing.ExecuteToolAsync("Visibility_3d", paramDictionary.Values,
environments, progressorSource.Progressor, GPExecuteToolFlags.RefreshProjectItems | GPExecuteToolFlags.AddToHistory);
// Process the result's error code and messages
Thanks!
If scenario 3 works when you run the GP from the GP dockpane but not when the tool is called inside an Add-in could mean we have a bug. However, If scenario 3 does not work when you run the GP "manually" then it won't work inside the Add-in either.
In scenario 3, the tool is unavailable in the GP dockpance with a note that it isn't licensed. It seems like ArcGIS Pro doesn't automatically check one out, but instead relies on the user to do so. Is that actually the case? My wording may have been unclear in the original question. If so, how soon can the ability to check a license out be added to the .NET API?
I found this idea on the ArcGIS Ideas forums relating to this issue: Automatically turn on licensed extensions when needed
Special thanks to Charles Macleod for looking into this at the DevSummit! This isn't yet available in the .NET SDK, but the CheckInExtension and CheckOutExtension methods are available in the Python SDK for a workaround in the meantime.
Hi Stephen, this is in the upcoming Pro SDK at 2.2.
Thanks, Chris!
Hi, is it possible to check which extension (Concurrent Use) is enabled (checked out) via the License Configuration window. As I see, it is possible to get the current license level held by the user using ArcGIS.Core.Licensing Namespace > LicenseInformation Class : Level Property. But I don't see a way to get the same for extensions. ArcGIS.Core.Licensing Namespace > LicenseInformation Class : IsAvailable Method lists all the extensions which are available on the license server, but how to get which of them are enabled by the user?