This demo demonstrate the use of the InitialView widget. It can be used in two ways : using Local or Resource views. See the widget documentation to know more. Here's a list of possibilities :



When using the "localViewField" parameter with a valid index value pointing to an existing localView from the widget options, that view is used to center the map. The name "localViewField" can be changed with an option.

When using a parameter equal to a resource "initViewUrlField" option value, then that resource is used. A get request is sent using the value of the parameter to get the according features and zoom on them. Layers of that resource are automatically turned on after recentering.

The map "zoomToMaxExtent" method can be replaced by the initial view using the "replaceZoomToMaxExtent" widget option, as demonstrated here. Try navigating the map then click the Earth button (first one) : instead of zooming out completely, the initial view is displayed again.

The "highlight" option is set in this demo, resulting in having a vector feature added on the map at the view position. It can be removed using the "unselectAll" widget which is the last button of the toolbar.