AnsweredAssumed Answered

AppStudio Offline Local Locator Zoom QML

Question asked by vanessa_glynn_linari_nps on Aug 30, 2016
Latest reply on Aug 31, 2016 by vanessa_glynn_linari_nps

I am creating an offline app using AppStudio Desktop and have the higher license level. I was able to utilize the Local Locator sample code and have that working fine. But was hoping for the app to zoom into the location once it finds it (it currently just puts a red plus sign there). Any ideas on how to do this? Maybe in the extent line:

onFindStatusChanged: {
            if (localLocator.findStatus === Enums.FindStatusCompleted) {
                if (localLocator.findResults.length < 1) {
                    showError("No Match Found");
                } else {
                    for (var i = 0; i < localLocator.findResults.length; i++) {
                        var result = localLocator.findResults[i];
                        console.log("Result", i, result.address, result.score, result.location.x, result.location.y, result.extent.toText(), result.spatialReference.toText(), result.toText());
                        var newGraphic = graphicLocation.clone();
                        newGraphic.geometry = result.location;
                        var id = graphicsLayerStops.addGraphic(newGraphic);
                    mainMap.extent = localLocator.findResults[0].extent;
            } else if (localLocator.findStatus === Enums.FindStatusErrored) {
                showError("Error: " + localLocator.findError.message + "\n\n");

Note, I am not a developer/programmer, just a GIS person who was hoping this would be easy to use!
I tried using the Feature Finder code I found on github, but can't get it to work offline and was told
by esri it won't work for offline yet (waiting for Quartz updates). I love the way that code works because
it also provides options for the name while you're typing in the search box. If anyone knows how
to pull that off for offline, that'd be icing!!