Skip to content
View on GitHub

Include an overview or inset map as an additional map view to show the wider context of the primary view.

Image of display overview map

Use case

An overview map provides a useful, smaller-scale overview of the current map view's location. For example, when you need to inspect a layer with many features while remaining aware of the wider context of the view, use an overview map to help show the extent of the main map view.

How to use the sample

Pan or zoom across the map view to browse through the tourist attractions feature layer and notice the viewpoint and scale of the linked overview map update automatically.

How it works

  1. Create an ArcGISMap with the arcGISTopographic basemap style and add it to the ArcGISMapViewController.
  2. Instantiate a FeatureLayer from a ServiceFeatureTable and append it to the ArcGISMap's operational layers.
  3. In the user interface, add an OverviewMap widget from the ArcGIS Maps SDK for Flutter Toolkit.
  4. Provide the ArcGISMapViewController to the controllerProvider property of the OverviewMap to connect the ArcGISMap with the OverviewMap.

Relevant API

  • ArcGISMapView
  • OverviewMap

About the data

The data used in this sample is the OpenStreetMap Tourist Attractions for North America feature layer, which is scale-dependent and displays at scales larger than 1:160,000.

Additional information

This sample uses the OverviewMap toolkit component, which requires the toolkit. For information about setting up the toolkit, as well as code for the underlying component, visit the toolkit repository.

Tags

context, inset, map, minimap, overview, preview, small scale, toolkit, view

Sample Code

display_overview_map.dart
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// Copyright 2026 Esri
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//   https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

import 'package:arcgis_maps/arcgis_maps.dart';
import 'package:arcgis_maps_sdk_flutter_samples/common/common.dart';
import 'package:arcgis_maps_toolkit/arcgis_maps_toolkit.dart';
import 'package:flutter/material.dart';

class DisplayOverviewMap extends StatefulWidget {
  const DisplayOverviewMap({super.key});

  @override
  State<DisplayOverviewMap> createState() => _DisplayOverviewMapState();
}

class _DisplayOverviewMapState extends State<DisplayOverviewMap>
    with SampleStateSupport {
  // Create a controller for the map view.
  final _mapViewController = ArcGISMapView.createController();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Stack(
        children: [
          // Add a map view to the widget tree and set a controller.
          ArcGISMapView(
            controllerProvider: () => _mapViewController,
            onMapViewReady: onMapViewReady,
          ),
          SafeArea(
            // Create an overview map and display on top of the map view in a stack.
            // Pass the overview map the corresponding map view controller.
            child: OverviewMap(controllerProvider: () => _mapViewController),
          ),
        ],
      ),
    );
  }

  Future<void> onMapViewReady() async {
    // Create a map with a topographic basemap style.
    final map = ArcGISMap.withBasemapStyle(.arcGISTopographic);
    _mapViewController.arcGISMap = map;

    // Set the initial viewpoint to a location in Vancouver, Canada.
    map.initialViewpoint = Viewpoint.withLatLongScale(
      latitude: 49.28299,
      longitude: -123.12052,
      scale: 70000,
    );

    // Create a feature layer with the Tourist Attractions service feature table.
    final serviceFeatureTable = ServiceFeatureTable.withUri(
      Uri.parse(
        'https://services6.arcgis.com/Do88DoK2xjTUCXd1/arcgis/rest/services/OSM_Tourism_NA/FeatureServer/0',
      ),
    );
    final featureLayer = FeatureLayer.withFeatureTable(serviceFeatureTable);

    // Add the feature layer to the map's operational layers.
    map.operationalLayers.add(featureLayer);
  }
}

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.