Cannot load locator created with ArcGIS Pro in ArcGIS Runtime SDK for WPF app

526
2
Jump to solution
05-31-2023 01:31 AM
SOTIRIOSTRIANTOS
New Contributor III

I created a POI locator using ArcGIS Pro. I have a wpf app and i want to use the created locator in that app.

I am trying to load it using the following code snippet.

 

 

            string streetMapOSMPath = AppDomain.CurrentDomain.BaseDirectory + "MapTest20200328_2.mmpk";
            string testmmpkPath = AppDomain.CurrentDomain.BaseDirectory + "test20230530.mmpk";
            string locatorPath = AppDomain.CurrentDomain.BaseDirectory + "GIS_test_20230_POI_Locator.loc";
            Uri _serviceUri = new Uri(locatorPath);
            try
            {
                // Load the package
                MobileMapPackage streetMapOSMPackage = await MobileMapPackage.OpenAsync(streetMapOSMPath);
                MobileMapPackage testMapOSMPackage = await MobileMapPackage.OpenAsync(testmmpkPath);

                // Load Geocoder
                //_geocoder = testMapOSMPackage.LocatorTask;
                  _geocoder = await LocatorTask.CreateAsync(_serviceUri);
}
            catch (Exception ex)
            {
                // Handle any exception
                System.Windows.MessageBox.Show(ex.Message, "Error opening package");
                return;
            }

 

 

 

I tried mmpk and .loc approaches with no success. i get LoadStatus: FailedToLoad.

Geocoder creation error: file too small to contain valid file header"

Any ideas?

0 Kudos
1 Solution

Accepted Solutions
MarkBockenhauer
Esri Regular Contributor

Which version of ArcGIS Pro did you use to create the locator? and which version of the Native Maps SDK are you using?

 

Then skipping ahead to a potential solution, there is an issue with Pro 3.1 creating locators that do not work in Native Maps SDKs 100.15.   The ArcGIS Pro 3.1.2 patch addresses this issue.

View solution in original post

0 Kudos
2 Replies
MarkBockenhauer
Esri Regular Contributor

Which version of ArcGIS Pro did you use to create the locator? and which version of the Native Maps SDK are you using?

 

Then skipping ahead to a potential solution, there is an issue with Pro 3.1 creating locators that do not work in Native Maps SDKs 100.15.   The ArcGIS Pro 3.1.2 patch addresses this issue.

0 Kudos
SOTIRIOSTRIANTOS
New Contributor III

thank you, my SDK was 100.11 and it didnt work even with 3.1.2 patch, i updated to the latest SDK and it worked. Another thing that i noticed is that i cannot access all the fields in the returned result. i.e whilst in the poi locator i registered a phone number i cannot access that info through .net. Through ArcGIS Pro i can see that info. i want to use phone number as an insurance policy that locator's score is valid. is there something that i am missing when creating Locator task object or calling the geocoding method?

0 Kudos