Hello I am completely new to using the ArcGIS API for JavaScript 4.11. I am creating a basic app that uses a search widget. I use the search.on function to grab the latitude and longitude of the location that is being searched. The problem is when I am running search.on the search widget no longer centers on the map when I search for a location and gives me a response of "No Results". Is there a way to re-center the map upon a search?

Here is my function so far:

search.on("search-complete", function (event) {
   let results = event.results;
   let latitude = event.results[0].results[0].extent.center.latitude;
   let longitude = event.results[0].results[0].extent.center.longitude;
  • 1
    Welcome to GIS SE. Please specify whether you are using the 3.x or the 4.x version of the ArcGIS API for JavaScript. – Marcelo Villa Jul 10 at 19:06

It zooms in fine for me - demo here. What search are you doing?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.