Automatic zoom to a feature

592
3
03-01-2019 03:28 AM
SimonCrutchley
Occasional Contributor II

Is it possible to automatically zoom to a feature, or a region of a map, just by clicking on it? I know you can set up bookmarks, but you then need to list all the possible options. Alternatively you have the option to "Zoom to" within a pop-up, but I just wondered whether there was a setting somewhere that would do it without the extra step. Specifically, I have a map of the UK with lots of features on it. Someone has suggested it would be useful to be able to hover over a given region and then zoom to that.

If it was possible, I'm not sure whether you would do this in Map or Web App Builder.

Thanks

Tags (1)
0 Kudos
3 Replies
RobertScheitlin__GISP
MVP Esteemed Contributor

Simon,

   The feature or region would have to be added to the map as a FeatureLayer (so that its features would have click events). The best route for this would be a custom widget that adds the features if they are not already present and enable the clickevent and subsequent zoom. This click would interfere with the maps standard popups so the would would enable the click event when open and disable it when the widget is closed.

0 Kudos
SimonCrutchley
Occasional Contributor II

Sorry, what's a "click event"? The features, a layer separated into regions, or a layer per region, whichever works best, would be added as feature layers as a matter of course.

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

Simon,

    A click event is a programattic ability for the feature to be clicked on in the map and have some code executed. This only occurs for FeatureLayers what load the actual geometry of the features into the map clientside. A ArcGISDyanmicMapServiceLayer is an image and does not know about individual features displayed in the map when on the client.

You would likely want a Map Service that has all the regions you are concerned about, that way you add one FeatureLayer to the map.

0 Kudos