<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Offline geocoding with MMPK locator in Qt Maps SDK Questions</title>
    <link>https://community.esri.com/t5/qt-maps-sdk-questions/offline-geocoding-with-mmpk-locator/m-p/1272560#M4900</link>
    <description>&lt;P&gt;So... I think I have one of the errors of my ways &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;With the LocatorTask declared (as in the bottom of the snippet above) and the suggestions.searchText bound to the TextField, a change to that textfield caused the suggestions to be generated.&lt;BR /&gt;&lt;BR /&gt;When the LocatorTask in the mmpk is used, the suggestions do not get returned.&lt;BR /&gt;&lt;BR /&gt;What I have done now, is explicitly call or should I rather say, set, the property when the value of the text field changes, like this:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;mmpk.locatorTask.suggestions.searchText = searchText; &lt;/LI-CODE&gt;&lt;P&gt;This does return suggestions, but only 5 and I cannot see how to change the maxResults parameter when the locator is pointing to the package LocatorTask.&lt;BR /&gt;&lt;BR /&gt;Any suggestions? &amp;lt;- no pun intended &lt;span class="lia-unicode-emoji" title=":rolling_on_the_floor_laughing:"&gt;🤣&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;Once I get this working, I will post a complete snippet as it may help someone else in the future.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 28 Mar 2023 16:22:47 GMT</pubDate>
    <dc:creator>smithse</dc:creator>
    <dc:date>2023-03-28T16:22:47Z</dc:date>
    <item>
      <title>Offline geocoding with MMPK locator</title>
      <link>https://community.esri.com/t5/qt-maps-sdk-questions/offline-geocoding-with-mmpk-locator/m-p/1269532#M4888</link>
      <description>&lt;P&gt;Hi all,&lt;BR /&gt;&lt;BR /&gt;I am new to Qt and QML though I have experience in .Net. I am using the samples provided in the appstudio to create an offline mobile app that will permit searching and eventually routing.&lt;BR /&gt;&lt;BR /&gt;I am stuck at trying to be able to search/find a POI using a locator which I have authored and packaged to an MMPK. I can load and view the contents just fine but geocoding based on the example is just not working.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It would appear that I cannot bind my search (text) field to the locator suggestions searchText&lt;BR /&gt;&lt;BR /&gt;Does anyone have an example of offline geocoding using an MMPK locator?&lt;BR /&gt;&lt;BR /&gt;I found that the sample works with mods to the url property but I do have to unpack the package, and set the url to the .loc file.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Mar 2023 04:22:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/qt-maps-sdk-questions/offline-geocoding-with-mmpk-locator/m-p/1269532#M4888</guid>
      <dc:creator>smithse</dc:creator>
      <dc:date>2023-03-21T04:22:19Z</dc:date>
    </item>
    <item>
      <title>Re: Offline geocoding with MMPK locator</title>
      <link>https://community.esri.com/t5/qt-maps-sdk-questions/offline-geocoding-with-mmpk-locator/m-p/1270538#M4894</link>
      <description>&lt;P&gt;Hi Smithse, hopefully I can be of some help. It looks like your workflow of connecting to the &lt;A href="https://developers.arcgis.com/qt/qml/api-reference/qml-esri-arcgisruntime-locatortask.html" target="_self"&gt;LocatorTask&lt;/A&gt;'s url property to the .loc file is correct, but you can also get a &lt;A href="https://developers.arcgis.com/qt/qml/api-reference/qml-esri-arcgisruntime-mobilemappackage.html#locatorTask-prop" target="_self"&gt;LocatorTask property&lt;/A&gt; from a loaded MobileMapPackage. If you'd like to avoid having to unpack or load an MMPK, you can also create a .loc file directly from ArcGIS Pro with the &lt;A href="https://pro.arcgis.com/en/pro-app/latest/help/data/geocoding/create-a-locator.htm" target="_self"&gt;Create a locator&lt;/A&gt; geoprocessing tool.&lt;BR /&gt;&lt;BR /&gt;If you'd like additional code to reference, you can take a look an another &lt;A href="https://github.com/Esri/arcgis-maps-sdk-samples-qt/tree/v.next/ArcGISRuntimeSDKQt_QMLSamples/Search/OfflineGeocode" target="_self"&gt;Offline Geocode sample&lt;/A&gt; in our Qt samples repo. That makes use of a &lt;A href="https://www.arcgis.com/home/item.html?id=3424d442ebe54f3cbf34462382d3aebe" target="_self"&gt;.loc file&lt;/A&gt; for San Diego that you can test your code with.&lt;BR /&gt;&lt;BR /&gt;Let me know if that helps, and I'm happy to provide any other assistance if necessary!&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2023 18:08:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/qt-maps-sdk-questions/offline-geocoding-with-mmpk-locator/m-p/1270538#M4894</guid>
      <dc:creator>Tanner_Yould</dc:creator>
      <dc:date>2023-03-22T18:08:02Z</dc:date>
    </item>
    <item>
      <title>Re: Offline geocoding with MMPK locator</title>
      <link>https://community.esri.com/t5/qt-maps-sdk-questions/offline-geocoding-with-mmpk-locator/m-p/1271728#M4897</link>
      <description>&lt;P&gt;Hi Tanner,&lt;BR /&gt;&lt;BR /&gt;Thanks for the response. That sample was very helpful in getting my first bit of code working, and is what I derive my working code from currently. For the life of me however, I cannot seem to be able to bind and get suggestions from the LocatorTask property of the loaded MMPK.&lt;BR /&gt;&lt;BR /&gt;My hacked together code currently consists of loading the map from the MMPK, and using the .loc from the same package, after is is unpacked. I guess I am essentially duplicating the data and just looking for a way to avoid this.&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Sean&lt;/P&gt;</description>
      <pubDate>Sun, 26 Mar 2023 12:17:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/qt-maps-sdk-questions/offline-geocoding-with-mmpk-locator/m-p/1271728#M4897</guid>
      <dc:creator>smithse</dc:creator>
      <dc:date>2023-03-26T12:17:20Z</dc:date>
    </item>
    <item>
      <title>Re: Offline geocoding with MMPK locator</title>
      <link>https://community.esri.com/t5/qt-maps-sdk-questions/offline-geocoding-with-mmpk-locator/m-p/1272203#M4898</link>
      <description>&lt;P&gt;Hm, if I understand correctly, you're able to get the locator task from your loaded MMPK but unable to retrieve any LocatorTask.suggestions when you create it that way. But you're able to get the suggestions when you create a LocatorTask component with a .loc file. I hope I have that correct.&lt;/P&gt;&lt;P&gt;Without seeing your code, I'm wondering if your LocatorTask is being instantiated correctly from the MMPK. It can be a little odd, so you might want to check out our&amp;nbsp;&lt;A href="https://github.com/Esri/arcgis-maps-sdk-samples-qt/blob/v.next/ArcGISRuntimeSDKQt_QMLSamples/Maps/MobileMap_SearchAndRoute/MobileMap_SearchAndRoute.qml#L262" target="_self"&gt;MobileMap_SearchAndRoute&lt;/A&gt; sample, where we get a LocatorTask from an MMPK rather than creating a component with a URL or path to a .loc file. Is there any possibility you can share some of your code? Alternatively, is there a way you can check if there are load errors or geocode errors? You can check with the following code block:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;Connections {
    target: locatorTask // the name of your locator task property

    function onLoadErrorChanged() {
        // Catch any errors when loading the task
        console.log(locatorTask.loadError.message, locatorTask.loadError.additionalMessage);
    }
    
    function onGeocodeStatusChanged() {
        // Catch any errors in the geocode process
        if (locatorTask.geocodeStatus === Enums.TaskStatusErrored) {
            console.log(locatorTask.error.message, locatorTask.error.additionalMessage);
        }
    }
    
    function onErrorChanged() {
        // Catch any other general errors
        console.log(locatorTask.error.message, locatorTask.error.additionalMessage);
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you, I hope that helps, and sorry for the trouble!&lt;/P&gt;</description>
      <pubDate>Mon, 27 Mar 2023 21:02:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/qt-maps-sdk-questions/offline-geocoding-with-mmpk-locator/m-p/1272203#M4898</guid>
      <dc:creator>Tanner_Yould</dc:creator>
      <dc:date>2023-03-27T21:02:36Z</dc:date>
    </item>
    <item>
      <title>Re: Offline geocoding with MMPK locator</title>
      <link>https://community.esri.com/t5/qt-maps-sdk-questions/offline-geocoding-with-mmpk-locator/m-p/1272293#M4899</link>
      <description>&lt;P&gt;Hi again, Tanner,&lt;/P&gt;&lt;P&gt;Thanks for the response and please, no apologies needed! &lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Below is some of the code: it's ugly as it's been chopped down to try and resolve this suggestions issue. When I get the LocatorTask from the MMPK, I don't seem to be able to set the suggestions.searchText property. Maybe this is what I am doing wrong and is the issue (here's hoping!)&lt;BR /&gt;&lt;BR /&gt;The code you provided closely matches mine, with the exception of the onErrorChanged() function, so I will play around with that and see if anything shows up. In the meantime, here's bits of what I have... and this all works fine. It would just be nice to not have to use two LocatorTask(s).&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;    

//MapView - when map changes, instantiate a locator
//This code has been made as short as possible as I am not looping though files and folders. We simply load the map and use (try to) the locator from the package
onMapChanged: {
        mapView.resetMap();

        // change the locatorTask: messed around here making sure it loaded
        mmpk.locatorTask.objectType === "LocatorTask" ? mapLocatorTask = mmpk.locatorTask: mapLocatorTask = null
       
        // determine if map supports routing
        if (mapView.map.transportationNetworks.length &amp;gt; 0) {
            currentRouteTask = ArcGISRuntimeEnvironment.createObject("RouteTask", {transportationNetworkDataset: mapView.map.transportationNetworks[0]});
            currentRouteTask.load();
        }

        else {
            currentRouteTask = null;
        }
    }


    //------------------BEGIN MobileMapPackage -------------------
    property string packageName: "QuikMap"
    property string sharedDataPath: AppFramework.resolvedPathUrl(
                                        AppFramework.userHomeFolder.filePath("ArcGIS/AppStudio/Data/")) + "/";

    property string packageFileNameWithPath: sharedDataPath + packageName + ".mmpk"

    MobileMapPackage {
        id: mmpk
        path: packageFileNameWithPath

        onLoadStatusChanged: {
            if (loadStatus !== Enums.LoadStatusLoaded)
                return;

            mapView.map = mmpk.maps[0];

            //Todo: some checks here about the mmpk that is being loaded

//Note: have also tried to instantiate the mapLocatorTask from here...

        }

        Component.onCompleted: {
            mmpk.load();
        }
    }
    //------------------END MobileMapPackage -------------------






//This is the locator task that works when pointing to a .loc
LocatorTask {
    id: locatorTask
    url:  locatorUrl //path to the .loc from the unpacked mmpk
    suggestions.suggestParameters: SuggestParameters{
        maxResults: 50
        preferredSearchLocation: currentViewPointCentre
    }
    suggestions.searchText: searchTextField.text
    onGeocodeStatusChanged: {
        if (geocodeStatus === Enums.TaskStatusCompleted) {
            if(geocodeResults.length&amp;gt;0){
                //code ommitted for clarity
            }
        }
    }
}







&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;Cheers again,&lt;BR /&gt;Sean&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2023 02:05:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/qt-maps-sdk-questions/offline-geocoding-with-mmpk-locator/m-p/1272293#M4899</guid>
      <dc:creator>smithse</dc:creator>
      <dc:date>2023-03-28T02:05:01Z</dc:date>
    </item>
    <item>
      <title>Re: Offline geocoding with MMPK locator</title>
      <link>https://community.esri.com/t5/qt-maps-sdk-questions/offline-geocoding-with-mmpk-locator/m-p/1272560#M4900</link>
      <description>&lt;P&gt;So... I think I have one of the errors of my ways &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;With the LocatorTask declared (as in the bottom of the snippet above) and the suggestions.searchText bound to the TextField, a change to that textfield caused the suggestions to be generated.&lt;BR /&gt;&lt;BR /&gt;When the LocatorTask in the mmpk is used, the suggestions do not get returned.&lt;BR /&gt;&lt;BR /&gt;What I have done now, is explicitly call or should I rather say, set, the property when the value of the text field changes, like this:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;mmpk.locatorTask.suggestions.searchText = searchText; &lt;/LI-CODE&gt;&lt;P&gt;This does return suggestions, but only 5 and I cannot see how to change the maxResults parameter when the locator is pointing to the package LocatorTask.&lt;BR /&gt;&lt;BR /&gt;Any suggestions? &amp;lt;- no pun intended &lt;span class="lia-unicode-emoji" title=":rolling_on_the_floor_laughing:"&gt;🤣&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;Once I get this working, I will post a complete snippet as it may help someone else in the future.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2023 16:22:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/qt-maps-sdk-questions/offline-geocoding-with-mmpk-locator/m-p/1272560#M4900</guid>
      <dc:creator>smithse</dc:creator>
      <dc:date>2023-03-28T16:22:47Z</dc:date>
    </item>
    <item>
      <title>Re: Offline geocoding with MMPK locator</title>
      <link>https://community.esri.com/t5/qt-maps-sdk-questions/offline-geocoding-with-mmpk-locator/m-p/1273331#M4901</link>
      <description>&lt;P&gt;Are you able to update the &lt;A href="https://developers.arcgis.com/qt/qml/api-reference/qml-esri-arcgisruntime-suggestparameters.html#maxResults-prop" target="_self"&gt;SuggestParameters.maxResult&lt;/A&gt; property? That would look like this:&amp;nbsp;&lt;BR /&gt;`mmpk.locatorTask.suggestions.suggestParameters.maxResults = 10; // or some number`.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2023 23:01:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/qt-maps-sdk-questions/offline-geocoding-with-mmpk-locator/m-p/1273331#M4901</guid>
      <dc:creator>Tanner_Yould</dc:creator>
      <dc:date>2023-03-29T23:01:04Z</dc:date>
    </item>
    <item>
      <title>Re: Offline geocoding with MMPK locator</title>
      <link>https://community.esri.com/t5/qt-maps-sdk-questions/offline-geocoding-with-mmpk-locator/m-p/1273464#M4902</link>
      <description>&lt;P&gt;Hey Tanner,&lt;BR /&gt;&lt;BR /&gt;So, I found that doesn't work, but this does:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;                        onTextChanged: {
                            console.log("Text changed: " + findText);
                            //currentLocatorTask.suggestions.suggestParameters.maxResults = 50; //errors out (TypeError: Value is null and could not be converted to an object

                            var suggestParams = ArcGISRuntimeEnvironment.createObject("SuggestParameters");
                            suggestParams.maxResults = 15;

                            currentLocatorTask.suggestions.suggestParameters = suggestParams;
                            currentLocatorTask.suggestions.searchText = findText;
                        }&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;Thanks again for your responses!&lt;/P&gt;</description>
      <pubDate>Thu, 30 Mar 2023 11:48:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/qt-maps-sdk-questions/offline-geocoding-with-mmpk-locator/m-p/1273464#M4902</guid>
      <dc:creator>smithse</dc:creator>
      <dc:date>2023-03-30T11:48:54Z</dc:date>
    </item>
  </channel>
</rss>

