Search widget won't zoom??

1039
13
Jump to solution
11-30-2018 08:36 AM
KarenEllett
Occasional Contributor

When I create a search widget (using 4.9) when I search for a location using the esri geocoder, it zooms to the result just fine.  But I've also defined a feature layer source, and it WON'T zoom to that result; only pan.  I've tried setting the zoomScale to several different values, but it makes no difference. It will pan, but not zoom.  Any help?? I can't find any examples with zoom at all.

Here's a pared down version:

searchWidgetTest = new Search({
  view: view,
  sources:[{
    featureLayer: new FeatureLayer({
      url: "https://server/arcgis/rest/services/folder/layers/MapServer/0"
    }),
  searchFields: ["NAME", "NUMBER"],
  zoomScale:200
  }]
});

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Esteemed Contributor

Karen,

   OK. I have tested and if you revert back to 4.8 then the zoomScale for a point FeatureLayer Does work but does not in 4.9. I just tested in 4.10 Beta and it does not work either. So you need to contact esri tech support and report this bug and Maybe it will get fixed before they release 4.10 in mid Dec.

View solution in original post

0 Kudos
13 Replies
RobertScheitlin__GISP
MVP Esteemed Contributor

Karen,

   What type of geometry is it?

0 Kudos
KarenEllett
Occasional Contributor

In this case, it's a point geometry.

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

Karen,

   Are you SURE that 200 is a valid scale from the map you are using? If you are using an esri basemap then 200 is Not a valid scale.

0 Kudos
KarenEllett
Occasional Contributor

That's just a random one I put in for the example; I've tried dozens of different scales.  The zoom works for all other geometry types, just not point.

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

Karen,

   OK. I have tested and if you revert back to 4.8 then the zoomScale for a point FeatureLayer Does work but does not in 4.9. I just tested in 4.10 Beta and it does not work either. So you need to contact esri tech support and report this bug and Maybe it will get fixed before they release 4.10 in mid Dec.

0 Kudos
KarenEllett
Occasional Contributor

Thank you!!

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

Don't forget to mark this question as answered by clicking on the "Mark Correct" link on the reply that answered your question.

0 Kudos
Shane_
by
New Contributor II

Hi Robert,

I also can't get the search widget (4.14) to zoom - it pans ok. It's a point layer using AGOL satellite basemap.  Any ideas?

Thanks,

Shane

require([
"esri/Map", "esri/views/MapView", "esri/views/SceneView", "esri/layers/FeatureLayer", "esri/widgets/LayerList", "esri/layers/GroupLayer",
"esri/widgets/Home", "esri/symbols/SimpleFillSymbol", "esri/layers/support/LabelClass", "esri/widgets/Search", "esri/widgets/Search/LayerSearchSource"],
function (Map, MapView, SceneView, FeatureLayer, LayerList, GroupLayer, Home, SimpleFillSymbol, LabelClass, Search, LayerSearchSource) {
var map = new Map({ basemap: "satellite" });

var searchWidget = new Search({
view: view,
allPlaceholder: "Search",
locationEnabled: false,
includeDefaultSources: false,
enableSearchingAll: false,
sources: [
{
layer: places_Layer,
searchFields: ["placename", "category"],
suggestionTemplate: "{placename}, {category}",
exactMatch: false,
outFields: ["*"],
name: "Places",
placeholder: "example: New York",
zoomScale: 250000
},
{
layer: clinics_Layer,
searchFields: ["name", "capability"],
suggestionTemplate: "{name}, {capability}",
exactMatch: false,
outFields: ["*"],
name: "Clinics",
placeholder: "example: Dental",
zoomScale: 250000
},
],
});

view.ui.add(searchWidget, { position: "top-right", index: 0 });

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

Shane,

   Seems like the zoomScale has not been working since 4.8. You would need to report this to esri tech support.

0 Kudos