Setting zoom scale for Infowindow result

3494
3
04-06-2015 12:39 PM
GeoffSchwitzgebel
New Contributor

I'm currently using the SimpleViewer template and want to customize the zoom scale for the resulting polygon that is returned in the search.  It appears that it has a default zoom scale (1000 in the API reference) set within the Search widget, but when I try and add the zoomScale property with my desired scale, it still uses the default setting.

I am thinking that this can be set somewhere within the graphics layer that is produced by the returned result, within the feature layer or within the infoWindow result?  I'm not sure what is the best way to implement this.

Here is the snippet for the search widget and its properties when it is instantiated:

var options = {

    map: this.map,

    addLayersFromMap: true,

    enableInfoWindow: true,

    minCharacters: 3,

    zoomScale: 4514                 

};

var searchLayers = false;

var search = new Search(options, domConstruct.create("div"));

Any help is appreciated.  Thanks.

Geoff

0 Kudos
3 Replies
RobertScheitlin__GISP
MVP Emeritus

Geoff,

   The zoomScale  is only for If the result does not have an associated extent,

Polygons have an extent and thus this does not come into play.

0 Kudos
BrianAnderson4
New Contributor II

The question then is how do we override the polygon extent. I'm working with parcels but do not want to zoom all the way to the parcel level. I would like to stop at "neighborhood" or even "city" level.

My "work around" is to set a maxZoom level when creating the base map. It is not the best option since then the map cannot be zoomed in past this value, but at least when the search is performed the map does not zoom all the way into the single polygon.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Brain,

You would set autoNavigate to false and then add an event listener to select-result event and the do your own zooming.

Search | API Reference | ArcGIS API for JavaScript | autoNavigate

Search | API Reference | ArcGIS API for JavaScript | select-result

0 Kudos