Maps and scenes§ 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)§.
You can use a map to:
- Display a basemap layer such as streets or satellite imagery.
- Access and display data layers based on files or services, including data you have authored.
- Provide context for temporary points, lines, polygons, or text displayed as graphics.
- Inspect data layers and display information from attributes.
- Measure distance and explore spatial relationships between geometries.
- Save a collection of layers as a web map to be shared across ArcGIS.
How a map works
A map works together with a map view to display geographic content in two dimensions. A map contains a collection of layers including multiple data layers from online or local sources, and a basemap layer that gives geographic context. A map can also contain datasets that enable searches for addresses or place names, networks for solving routes, 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 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.
§ This capability has not yet been implemented in ArcGIS Maps SDK for Flutter, but will be added in a future release. See this page for more details.Map
A map contains a collection of layers 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 and then one or more data layers.
// Authenticate with an API key access token or user authentication
// to access a basemap style.
// ArcGISEnvironment.apiKey = 'YOUR_ACCESS_TOKEN';
@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 (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 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 to represent real-world entities using point, line, or polygon geometries. In addition to geometry, features have attributes 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) 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 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 in one or more collections of graphics overlays. The graphics managed by the map view always display above all layers displayed in the map.
A map view 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 a map 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
-
Create a new
ArcGISMap
with theBasemapStyle
constructor. -
Optionally, add one or more data layers to the map.
-
Assign the map to the ArcGIS map view controller's
arcGISMap
property. -
Call the ArcGIS map view controller's
setViewpoint()
and pass in aViewpoint
to focus on a specified area of the map.
// 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,
),
);
You can also create and save a web map using ArcGIS Pro or the ArcGIS Online map viewer and open it in your app.
Display a web map
You can open a web map saved as an item in a portal, such as ArcGIS Online, using its item ID 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
-
Create a
Portal
object to connect to ArcGIS Online that is hosting a web map you want to load. -
Create a
PortalItem
object using the itemId for the item that stores the web map. -
Create a new
ArcGISMap
, passing the portalItem into the constructor. -
Assign the map view controller's
arcGISMap
property to your map.
// 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;
Use API key access tokens
An API Key access token can be used to authorize access to ArcGIS Online services and resources from your app, as well as to monitor access to those services. You can use a single access token for all requests made by your app, or assign individual access tokens for any classes that implements ApiKeyResource