A map is a canvas that draws layers of geographic data. Different layer types are used to draw different data types. For example, you may have data that is provided by a service or from local files; the data might be static in nature, or change over time. Maps can also show information relating to the map and its layers, such as GPS locations, and pop-ups.
The MapGraphicsView class reimplements Qt's QGraphicsView to be added as a widget to your application. The MapGraphicsView must be passed a Map to initialize and interact with. The widget events (mouse events, touch events, resize events) occurring within the MapGraphicsView are handled and passed on to interact with the Map.
To enable the workflows your app requires, and to maximize display performance, always consider the factors below when you create your map.
Layers can generally be thought of as basemaps, operational, or graphics layers, depending on the data they display and how they are used, with each type of layer offering different functionality and performance characteristics.
- Background data that provides context and does not change often is generally considered as the basemap, for example, topography, imagery, streets, or buildings data. Basemap data is generally prepared and cached on a server as ready-to-access image tiles that are efficient to request and display in an app. ArcGIS Online provides a free set of ready-to-use basemap layers that are pre-rendered and cached to ensure they draw quickly. Alternatively, you can use the ArcGIS platform to create your own basemaps. For details on using offline basemaps, see Create an offline map.
- Data edited by app users, periodically changing data, or data resulting from analyses, may best be considered as operational layers. Typically, operational data is created and maintained by your organization. Displaying or working with operational data is often the main focus of an app.
- Live, rapidly changing, ephemeral data may be appropriate for a graphics layer. For example, vehicle or workforce locations, geotriggered events, or temporary query results. Graphics are generated in memory in an app, or created in an app based on an external information feed.
Other types of specialized layers provide the ability to add a wide range of data and services to a map, for example WMS services and KML.
A wide variety of layer classes are provided by the API. Each can be used to display a specific data type, and each has its own functionality and performance characteristics. Generally, each layer class is used for basemap, operational, or graphics layers. However, these are not absolute rules, and the choice of class should be based on an understanding of the characteristics of each type.
The layer order in a map is important. Basemaps typically cover the entire surface of the map. They are added to the map first so that they draw under the layer and do not obscure other layers. Layers can be re-ordered, but this will not change the map's spatial reference.
Add operational layers to the map next. Graphics layers are typically added last and show on top of all other layers.
Maps and layers use spatial references to help define where coordinates are located on the earth's surface. Distance units and coordinates of map operations are determined by the spatial reference of the map. The first layer in a map, typically the basemap, defines the spatial reference of the map, and this cannot be changed.
If the spatial reference of layers in a map are different to the spatial reference of the map, the layers must be reprojected to the spatial reference of the map before displaying. Some layer types cannot be re-projected, for example, tiled map layer services draw and cache on a server, and cannot be changed on the client.
To maximize performance, avoid reprojection entirely by ensuring all layers have the same spatial reference as the map.
Behavior at runtime
Also consider how the map draws and behaves at runtime, and how the user interacts with it.
Map and layer initialization
Maps are initialized asynchronously after being created. Layers are also initialized asynchronously when added to the map. Attempting to access certain properties or operations of the map or its layers before they are initialized may throw errors. For example, getting the spatial reference or center of a map, or the name or extent of a layer. You can connect a slot to the signal Map::mapReady that emits when the Map is initialized. It's also good practice to set the initial extent of the map to ensure the user starts in a location relevant to the map's usage.
Most flat representations of the world only extend to 180 degrees east and west longitude, the approximate location of the international date line, making it more difficult to visualize routes or shapes that cross the pacific ocean. However, the map can be configured to display the eastern and western hemispheres wrapping around each other and forming a continuous surface, giving the impression that the map is endless. Panning a map becomes similar to spinning a globe.
Navigation and interaction
Consider what actions or gestures you enable to allow users to zoom, pan, and rotate the map. Actions such as clicking mouse buttons, dragging the cursor, rolling the mouse wheel and using touch gestures allow users to pan and zoom map contents and explore attributes of individual features. This mouse interaction happens by default because the mouse events are captured by the Map class.
Geographic data can change over time; therefore, some layers may show stored temporal data, which is information about the changing state of a dataset over time. For example, the progression of a hurricane changes in sea temperature, destruction of wildlife habitat, or the spread of disease. These layers are called time-aware layers.
You can configure a map with time-aware layers to display different periods of time. Stepping through time in your map can help you easily identify trends and patterns in the data that may have otherwise remained unnoticed.