Maps A map is a collection of layers that are displayed in 2D. It is typically composed of a basemap layer and data layers. Learn more and scenes A scene is a collection of layers that are displayed in 3D. It is typically composed of a basemap layer, data layers, and 3D data. Learn more provide interactive displays of geographic data that enable you to visualize and explore patterns, answer questions, and share insight. They can be opened, edited, and shared across the ArcGIS system and beyond. Maps are designed for interaction in two dimensions (2D) and scenes for interaction in three dimensions (3D).

See Scenes (3D) in this guide for more information about working with scenes.

You can use a map to:

  • Display a basemap layer A basemap layer is the layer in a map or scene that displays basemap data. The data source for a basemap layer is typically a basemap service. Learn more such as streets or satellite imagery.
  • Access and display data layers A data layer is a layer that references geographic data from a file or a service and is used to visualize the data in a map or scene. Learn more based on files or services, including data you have authored.
  • Provide context for temporary points, lines, polygons, or text displayed as graphics A graphic is a visual element composed of a geometry, symbol, and attributes that is displayed on a map or scene. Learn more .
  • Inspect data layers and display information from attributes Attributes are fields and values for a single feature or non-spatial record. They are typically stored in a database or service such as a feature service. Learn more .
  • Measure distance and explore spatial relationships between geometries A geometry is a geometric shape, such as a point, polyline, or polygon, that contains one or more coordinates and a spatial reference. Learn more .
  • Save a collection of layers as a web map A web map is a map stored as a JSON object that defines properties such as the basemap layer, data layers, layer styles, and pop-up styles. Its JSON structure is defined by the web map specification. Learn more to be shared across ArcGIS.

How a map works

A map A map is a collection of layers that are displayed in 2D. It is typically composed of a basemap layer and data layers. Learn more works together with a map view A map view is a user interface that displays map layers and graphics in 2D. It controls the area (extent) of the map that is visible and supports user interactions such as pan and zoom. Learn more to display geographic content in two dimensions. A map contains a collection of layers A layer is a reference to a collection of geographic data that is used to access and display data. The data for layers are typically provided by the basemap layer service and data services. Learn more including multiple data layers A data layer is a layer that references geographic data from a file or a service and is used to visualize the data in a map or scene. Learn more from online or local sources, and a basemap layer A basemap layer is the layer in a map or scene that displays basemap data. The data source for a basemap layer is typically a basemap service. Learn more that gives geographic context. A map can also contain datasets that enable searches for addresses or place names, networks for solving routes A route is a polyline that defines the best path between two or more points in a street network. Learn more , utility networks for tracing the flow of services such as water and electricity, and non-spatial tables. Maps can be created, displayed, edited, and saved. Because the format is based on the ArcGIS web map standard, these maps can be shared uniformly across the ArcGIS system.

For offline An offline application, also known as offline app, is an application that runs on a phone, tablet, laptop or desktop device with limited or no network connection. Offline applications are built with ArcGIS Maps SDKs for Native Apps. Learn more workflows (when you don’t have network connectivity), you can open a map stored in a mobile map package. Mobile map packages can be created using ArcGIS Pro, ArcGIS Enterprise, or ArcGIS Online. See Offline maps, scenes, and data for more information about implementing offline workflows in your apps.

Map

A map contains a collection of layers A layer is a reference to a collection of geographic data that is used to access and display data. The data for layers are typically provided by the basemap layer service and data services. Learn more displayed in the order in which they were added, with the most recently added layer being displayed above existing layers. You can use the map to change the display order of layers as well as to control which layers are visible, and expose this functionality with user interface controls such as lists, check boxes, or switches. A map also contains a collection of bookmarks, which, similar to a web browser bookmark, allow you to quickly navigate to a predefined area of the map.

You can open an existing map or create one entirely with code. To create a map, you typically first add a basemap layer A basemap layer is the layer in a map or scene that displays basemap data. The data source for a basemap layer is typically a basemap service. Learn more and then one or more data layers A data layer is a layer that references geographic data from a file or a service and is used to visualize the data in a map or scene. Learn more .

// Authenticate your application using a supported method:
// - API key authentication
// - User authentication
@override
Widget build(BuildContext context) {
return Scaffold(
// Add a map view to the widget tree and set a controller and a map with a basemap style.
body: ArcGISMapView(
controllerProvider: () => ArcGISMapView.createController()
// Creates a map with the topographic basemap style.
..arcGISMap = ArcGISMap.withBasemapStyle(BasemapStyle.arcGISTopographic),
),
);
}

You can also open a map stored in a portal ArcGIS portal, also known as a portal, is a website with applications and tools that can be used to create, manage, access, and share geospatial content and data. It supports security and authentication, developer credentials, content and data service management, user and group management, and site administration. A portal can be hosted in Esri's infrastructure or your own infrastructure. Learn more (such as ArcGIS Online) using its URL.

@override
Widget build(BuildContext context) {
return Scaffold(
// Add a map view to the widget tree and set a controller and a map with a web map from a URL.
body: ArcGISMapView(
controllerProvider: () => ArcGISMapView.createController()
// Creates a map with the web map.
..arcGISMap = ArcGISMap.withUri(
Uri.parse(
'https://www.arcgis.com/home/item.html?id=acc027394bc84c2fb04d1ed317aac674',
),
),
),
);
}

You can define the initial extent at which the map will display by setting the ArcGISMap.initialViewpoint property.

Layer

Each layer A layer is a reference to a collection of geographic data that is used to access and display data. The data for layers are typically provided by the basemap layer service and data services. Learn more in a map references geographic data, either from an online service or from a local dataset. There are different types of layers that can be added to a map, each designed to display a particular type of data. Some layers display images, such as satellite imagery or aerial photography, while others are composed of a collection of features A feature is a single record, also known as a row, that represents a real-world entity. It typically contains a geometry (point, multipoint, polyline, or polygon) and attributes but it can also contain just attributes. Learn more to represent real-world entities using point, line, or polygon geometries A geometry is a geometric shape, such as a point, polyline, or polygon, that contains one or more coordinates and a spatial reference. Learn more . In addition to geometry, features have attributes Attributes are fields and values for a single feature or non-spatial record. They are typically stored in a database or service such as a feature service. Learn more that provide details about the entity it represents.

The Layer class is the base class for all types of layers. The type of layer you create depends on the type of data you want to display. For example, to display feature data you can create an FeatureLayer that references an online service (such as a feature service A feature service is a data service that provides access to spatial and non-spatial data in feature layers, feature layer views, and tables. Learn more ) or a supported local dataset.

// Create a new trail heads feature layer from its URL.
final trailheadsLayer = FeatureLayer.withFeatureTable(
ServiceFeatureTable.withUri(
Uri.parse(
'https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/Trailheads_Styled/FeatureServer/0',
),
),
);
// Create a new trails feature layer from its URL.
final trailsLayer = FeatureLayer.withFeatureTable(
ServiceFeatureTable.withUri(
Uri.parse(
'https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/Trails_Styled/FeatureServer/0',
),
),
);
// Create a new open spaces feature layer from its URL.
final openSpacesLayer = FeatureLayer.withFeatureTable(
ServiceFeatureTable.withUri(
Uri.parse(
'https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/Parks_and_Open_Space_Styled/FeatureServer/0',
),
),
);
// Add all feature layers to the map.
map.operationalLayers.addAll([trailheadsLayer, trailsLayer, openSpacesLayer]);

MapView

A map view A map view is a user interface that displays map layers and graphics in 2D. It controls the area (extent) of the map that is visible and supports user interactions such as pan and zoom. Learn more is a user-interface control that displays a single map in your app. It contains built-in functionality that allows the user to explore the map by zooming in and out, recentering the map display, or getting additional information about elements in the map. It also manages graphics A graphic is a visual element composed of a geometry, symbol, and attributes that is displayed on a map or scene. Learn more in one or more collections of graphics overlays A graphics overlay is a client-side, temporary container of graphics to display on a map view or scene view. Learn more . The graphics managed by the map view always display above all layers displayed in the map.

A map view A map view is a user interface that displays map layers and graphics in 2D. It controls the area (extent) of the map that is visible and supports user interactions such as pan and zoom. Learn more control also allows you to:

  • Access data for data layers and graphics.
  • Display the current location as a point on the map.
  • Identify and select features at a specified location.
  • Export an image of the current display.
  • Rotate the map display.
  • Apply a time extent to filter the display of features.
  • Filter layer data using attribute and spatial criteria.
  • Display image overlays on the map view.

Display a map A map is a collection of layers that are displayed in 2D. It is typically composed of a basemap layer and data layers. Learn more by adding it to a ArcGISMapView control. Changes you make to the map, such as adding, removing, or reordering layers, will immediately be reflected in the map view display. The ArcGISMap.initialViewpoint property will determine the area of the map shown when the map loads. You can also adjust the ArcGISMapViewController.setViewpoint() and ArcGISMapViewController.setViewpointRotation() programmatically to change the map area or orientation shown in the display.

// Create a map with a topographic basemap style.
final map = ArcGISMap.withBasemapStyle(BasemapStyle.arcGISTopographic);
// Create an initial envelope.
final initialEnvelope = Envelope.fromXY(
xMin: -118.805,
yMin: 34.027,
xMax: -118.795,
yMax: 34.037,
spatialReference: SpatialReference.wgs84,
);
// Create and set the initial viewpoint to the map.
map.initialViewpoint = Viewpoint.fromTargetExtent(initialEnvelope.extent);
// Set the map to the map view.
mapViewController.arcGISMap = map;

Examples

Create and display a map

You can display a basic map by creating one with a basemap layer, setting its initial extent, and adding it to a map view.

Steps

  1. Create a new ArcGISMap with the BasemapStyle constructor.

  2. Optionally, add one or more data layers to the map.

  3. Assign the map to the ArcGIS map view controller’s arcGISMap property.

  4. Call the ArcGIS map view controller’s setViewpoint() and pass in a Viewpoint to focus on a specified area of the map.

38 collapsed lines
import 'package:arcgis_maps/arcgis_maps.dart';
import 'package:flutter/material.dart';
void main() {
ArcGISEnvironment.apiKey = 'YOUR_ACCESS_TOKEN';
runApp(
const MaterialApp(
home: DisplayAMapExample(),
),
);
}
class DisplayAMapExample extends StatefulWidget {
const DisplayAMapExample({super.key});
@override
State<DisplayAMapExample> createState() => _DisplayAMapExample();
}
class _DisplayAMapExample extends State<DisplayAMapExample> {
final _mapViewController = ArcGISMapView.createController();
@override
Widget build(BuildContext context) {
return Scaffold(
body: ArcGISMapView(
controllerProvider: () => _mapViewController,
onMapViewReady: onMapViewReady,
),
);
}
void onMapViewReady() {
// Define a final variable, map, and initialize it to an ArcGISMap
// with the ArcGIS Topographic basemap style.
final map = ArcGISMap.withBasemapStyle(BasemapStyle.arcGISTopographic);
// Set the ArcGIS map view controller's arcgisMap property to the map.
_mapViewController.arcGISMap = map;
// Call setViewpoint() to zoom to the Santa Monica Mountains in
// California.
_mapViewController.setViewpoint(
Viewpoint.withLatLongScale(
latitude: 34.02700,
longitude: -118.80500,
scale: 72000,
),
);
3 collapsed lines
}
}

You can also create and save a web map A web map is a map stored as a JSON object that defines properties such as the basemap layer, data layers, layer styles, and pop-up styles. Its JSON structure is defined by the web map specification. Learn more using ArcGIS Pro ArcGIS Pro is a professional desktop GIS application that can explore, visualize, analyze, and manage 2D and 3D data. Learn more or the ArcGIS Online ArcGIS Online is a GIS mapping, analytics, data hosting, and content management software as a service (SaaS) product. It includes applications, tools, APIs, and location services for users and developers. It is subscription-based and requires an ArcGIS Online account. Learn more map viewer and open it in your app.

Display a web map

You can open a web map A web map is a map stored as a JSON object that defines properties such as the basemap layer, data layers, layer styles, and pop-up styles. Its JSON structure is defined by the web map specification. Learn more saved as an item An item, also known as a content item, is a resource stored in a portal such as a web map, hosted layer, style, script tool, file, or notebook. Learn more in a portal ArcGIS portal, also known as a portal, is a website with applications and tools that can be used to create, manage, access, and share geospatial content and data. It supports security and authentication, developer credentials, content and data service management, user and group management, and site administration. A portal can be hosted in Esri's infrastructure or your own infrastructure. Learn more , such as ArcGIS Online, using its item ID An item ID is a unique identifier representing a single item stored, managed, and accessed in a portal, such as a web map, hosted layer, or file. Learn more or URL. A portal item can be secured to only allow access for authorized users, in which case you must provide credentials for access. To learn how to access secured content, see Security and authentication.

Steps

  1. Create a Portal object to connect to ArcGIS Online that is hosting a web map you want to load.

  2. Create a PortalItem object using the itemId An item ID is a unique identifier representing a single item stored, managed, and accessed in a portal, such as a web map, hosted layer, or file. Learn more for the item that stores the web map.

  3. Create a new ArcGISMap, passing the portalItem An item, also known as a content item, is a resource stored in a portal such as a web map, hosted layer, style, script tool, file, or notebook. Learn more into the constructor.

  4. Assign the map view controller’s arcGISMap property to your map.

41 collapsed lines
import 'package:arcgis_maps/arcgis_maps.dart';
import 'package:flutter/material.dart';
void main() {
ArcGISEnvironment.apiKey = 'YOUR_ACCESS_TOKEN';
runApp(
const MaterialApp(
home: DisplayAWebMapExample(),
),
);
}
class DisplayAWebMapExample extends StatefulWidget {
const DisplayAWebMapExample({super.key});
@override
State<DisplayAWebMapExample> createState() => _DisplayAWebMapExample();
}
class _DisplayAWebMapExample extends State<DisplayAWebMapExample> {
final _mapViewController = ArcGISMapView.createController();
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
children: [
Expanded(
child: ArcGISMapView(
controllerProvider: () => _mapViewController,
onMapViewReady: onMapViewReady,
),
),
],
),
);
}
void onMapViewReady() {
// Instantiate a Portal object to connect to the portal anonymously.
final portal = Portal.arcGISOnline();
const itemId = '41281c51f9de45edaf1c8ed44bb10e30';
// Create a PortalItem object using the item ID that
// references the web map.
PortalItem portalItem = PortalItem.withPortalAndItemId(
portal: portal,
itemId: itemId,
);
// Create a new map with the portal item.
final map = ArcGISMap.withItem(portalItem);
// Assign the map to the map view controller's arcGISMap property.
_mapViewController.arcGISMap = map;
3 collapsed lines
}
}

Display a mobile map

This example displays a map A map is a collection of layers that are displayed in 2D. It is typically composed of a basemap layer and data layers. Learn more from a mobile map package A mobile map package (MMPK) is a standalone file that contains one or more map definitions, including the basemap layers, data layers, layer styles, and pop-up styles for use in offline applications built with ArcGIS Maps SDKs for Native Apps. Learn more . You can create your own mobile map (or scene) packages using ArcGIS Pro or download existing ones from ArcGIS Online. The Yellowstone mobile map package, for example, shows points of interest in Yellowstone National Park.

Steps

  1. Create a MobileMapPackage using the path to a local .mmpk file.

  2. Call MobileMapPackage.load() to load the package.

  3. When the package loads, get the first map from the package using the MobileMapPackage.maps property.

  4. Display the map in a ArcGISMapView.

63 collapsed lines
import 'dart:io';
import 'package:arcgis_maps/arcgis_maps.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:path_provider/path_provider.dart';
void main() {
runApp(const MaterialApp(home: DisplayAMobileMapExample()));
}
class DisplayAMobileMapExample extends StatefulWidget {
const DisplayAMobileMapExample({super.key});
@override
State<DisplayAMobileMapExample> createState() => _DisplayAMobileMapExampleState();
}
class _DisplayAMobileMapExampleState extends State<DisplayAMobileMapExample> {
final _mapViewController = ArcGISMapView.createController();
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
children: [
Expanded(
child: ArcGISMapView(
controllerProvider: () => _mapViewController,
onMapViewReady: onMapViewReady,
),
),
],
),
);
}
void onMapViewReady() async {
const mobileMapPackageName = 'Yellowstone.mmpk';
// Retrieve the mobile map package from the asset bundle.
final mobileMapPackageData = await rootBundle.load(
'assets/$mobileMapPackageName',
);
// Path to a temporary directory on the device.
// NOTE: This location is not backed up and is suitable for storing
// caches of downloaded files, in this case, your mobile map package.
final platformTempDir = await getTemporaryDirectory();
// Define the path on the device to the mobile map package.
final pathToFile = '${platformTempDir.absolute.path}/$mobileMapPackageName';
// Create a new file using the path to the mobile map package.
final mobileMapPackageFile = File(pathToFile);
// Synchronously write the mobile map package to the file
// on the device.
mobileMapPackageFile.writeAsBytesSync(
mobileMapPackageData.buffer.asUint8List(),
flush: true,
);
// Create a mobile map package using the Uri to the mobile map package file.
final mobileMapPackage = MobileMapPackage.withFileUri(
mobileMapPackageFile.uri,
);
// Load the metadata for the mobile map package.
await mobileMapPackage.load();
// Check that the mobile map package is not empty.
if (mobileMapPackage.maps.isNotEmpty) {
// Display the first map in the mobile map package in the map
// view controller.
_mapViewController.arcGISMap = mobileMapPackage.maps.first;
}
3 collapsed lines
}
}

Use API key access tokens

An API key access token An access token is an authorization string that provides access to secure ArcGIS content, data, and services. Its capabilities are determined by the privileges it supports. It is obtained by implementing API key authentication, User authentication, or App authentication. Learn more can be used to authorize access to ArcGIS services A service, also known as an ArcGIS service, is software that supports an ArcGIS REST API and provides geospatial functionality or data. A service can be hosted by Esri or in ArcGIS Enterprise. Learn more and portal items from your app, as well as to monitor access to those services. You can use a single access token An access token is an authorization string that provides access to secure ArcGIS content, data, and services. Its capabilities are determined by the privileges it supports. It is obtained by implementing API key authentication, User authentication, or App authentication. Learn more for all requests made by your app, or assign individual access tokens An access token is an authorization string that provides access to secure ArcGIS content, data, and services. Its capabilities are determined by the privileges it supports. It is obtained by implementing API key authentication, User authentication, or App authentication. Learn more for any classes that implement ApiKeyResource.

Learn more about API key authentication

Tutorials

Samples

Services