How to set zoom level for search results with a polygon Feature Layer

5014
4
05-19-2016 10:25 AM
KimberlyGraham1
New Contributor III

I am using 3.16 API to create an application that searches our local parcel layers using a custom search - I am quite new at Java Script. The layer is a polygon Feature Layer. I am only finding information that tells you how to set the zoomLevel using points - is it not possible to create a custom zoom extent for polygon Feature Layers?  I would like it to not zoom in nearly as far as it does as the output we want to see would be in relation to other buildings.

Thanks!

0 Kudos
4 Replies
RobertScheitlin__GISP
MVP Emeritus

Kimberly,

Unfortunately the zoom for a feature that returns an extent is not configurable. You would have to turn off the autoNavigate and then add your own zooming logic to a custom select-result event handler.

KimberlyGraham1
New Contributor III

Thank you for your response!  I figured it was something along those lines; unfortunately, that's a bit above me at the moment so we will just have to have our users manually zoom out until I can get figure out how to do all that.

0 Kudos
RoxanneWilson
New Contributor III

I have a somewhat followup question.  I have a map where I want residents to be able to search for their address and have it highlight in the map.  If I turn off that autoNavigate you mentioned above, that will stop the widget from zooming to the result?  How do I turn off the autoNavigate feature?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Roxanne,

  Yes it will.

      var search = new Search({
        map: map,
        autoNavigate: false
      }, "search");
0 Kudos