Wpf arcgis engine does not currently have or has not enabled Spatial Analyst licensing Solution

Source: Internet
Author: User

When I used wpf for overlay analysis, I encountered an ERROR: "ERROR 010096: no Spatial Analyst permission is currently enabled or not "; the Spatial Analyst Extension function is checked in the environment and cannot be solved. Now, I will write down the solution for your reference:

The solution is to add a sentence when initializing the license in the app. The following is the license code of my app. cs in the app class.

// Set a license for alicense

// Of course, some class libraries must be referenced here, which are all built-in with arcgis.
Protected override void OnStartup (StartupEventArgs e)
{
ESRI. ArcGIS. RuntimeManager. Bind (ESRI. ArcGIS. ProductCode. EngineOrDesktop );
Initlicense ();

// The pop-up form is displayed. The app foreground removes startupUri. Otherwise, two forms will pop up.
New Arcmap (). Show ();
}
Public void initlicense ()
{
AoInitialize aoi = new AoInitialize ();
EsriLicenseExtensionCode extensionCodes = esriLicenseExtensionCode. esriLicenseExtensionCodeSpatialAnalyst; // This is the solution
EsriLicenseExtensionCode extensionCode = esriLicenseExtensionCode. esriLicenseExtensionCode3DAnalyst;
EsriLicenseProductCode pro = esriLicenseProductCode. esriLicenseProductCodeEngine;
If (aoi. IsProductCodeAvailable (pro) = esriLicenseStatus. esriLicenseAvailable &&
Aoi. IsExtensionCodeAvailable (pro, extensionCode) = esriLicenseStatus. esriLicenseAvailable &&
Aoi. IsExtensionCodeAvailable (pro, extensionCodes) = esriLicenseStatus. esriLicenseAvailable
)
{
Aoi. Initialize (pro );
Aoi. CheckOutExtension (extensionCode );
Aoi. CheckOutExtension (extensionCodes );
}
}

 

The attributes in esriLicenseExtensionCode have many loading methods similar to those above.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.