MapView QML Type

  • Esri.ArcGISRuntime
  • MapView
  • A MapView that renders data in a map and allows users to interact with the map. More...

    Import Statement: import Esri.ArcGISRuntime
    Since: Esri.ArcGISRuntime 100.0
    Inherits:

    GeoView

    Properties

    Signals

    Methods

    Detailed Description

    To display a Map, add a MapView control to your app and assign the map to it. This loads the map, its basemap and collection of operational layers, and displays their content on screen. User interactions such as pan, zoom, rotate, and identify or selection are supported in the MapView using touch, mouse, keyboard or pen/pencil. If required, you can override keys, clicks, and gestures to provide a specific user experience.

    The visible area of the MapView is represented by the Viewpoint. You can programmatically set the visible by specifying a viewpoint. For example, MapView::setViewpointGeometry sets the visible area to the extent of a provided geometry, and MapView::setViewpointCenter zooms to a given scale, centered at the given point. Any geometries passed to these methods are automatically projected to match the SpatialReference of the map view's Map, if required. To determine the current visible area or the center point and scale of a MapView, call GeoView::currentViewpointExtent or GeoView::currentViewpointCenter. Call GeoView::navigating to ensure that any user-initiated or programmatic navigation is complete before getting the current Viewpoint. In an MVC architecture, this class represents the View tier. The Model tier is represented by the Map object which provides a collection of operational layers and a Basemap. A Layer provides a visual representation of geographic information and comes in many forms. The types of layers that are displayed in a MapView are two-dimensional in nature; meaning they are displayed in X/Y coordinate space.

    In a Model-View-Controller (MVC) architecture, a map view represents the view and a map represents the model.

    This QML type supports the following default properties. A default property may be declared inside another declared object without being assigned explicitly to a property.

    Refer to the GeoView documentation for any additional default properties.

    Example:

    Create MapView that contains a Map with the Imagery with Labels Basemap:

    MapView {
        anchors.fill: parent
    
        Component.onCompleted: {
            // Set the focus on MapView to initially enable keyboard navigation
            forceActiveFocus();
        }
    
        Map {
            Basemap {
                initStyle: Enums.BasemapStyleArcGISImagery
            }
        }
    }

    See also Cancelable, Map, and GeoView.

    Property Documentation

    allowMagnifierToPanMap : bool

    Whether the magnifier should be allowed to pan the map.


    [default] backgroundGrid : BackgroundGrid

    The background grid that a Map is displayed on top of.

    BackgroundGrid defines the color and context grid displayed in the MapView. If a map has been assigned, the Map displays on top of this background grid.

    If the Map contains transparent areas, the BackgroundGrid may be visible within the Map::maxExtent and you may wish to define a BackgroundGrid::color appropriate to your map's symbology. If a Map has a Map::backgroundColor, the MapView::backgroundGrid is ignored.

    The default BackgroundGrid color is gray with black grid lines.


    [read-only] calloutData : CalloutData

    The data and location used for displaying a callout on the map.

    The callout data that is returned can be modified, and then used with a view for display.


    [default, since Esri.ArcGISRuntime 200.1] geometryEditor : GeometryEditor

    Allows users to interactively create and edit geometries by interacting with the view.

    This property was introduced in Esri.ArcGISRuntime 200.1.


    [default] grid : ArcGISGrid

    The coordinate system grid to display on top of the MapView.

    The Grid is a collection of horizontal and vertical lines which can be rendered over the top of a MapView to help show the location of the current Viewpoint. Supported grids include Military Grid Reference System (MGRSGrid), United States National Grid (USNGGrid), Universal Transverse Mercator (UTMGrid), and a grid of latitude and longitude lines (LatitudeLongitudeGrid). You can configure these grids by toggling their visibility and modifying their default layout and appearance. A grid will not display in the MapView until a Map has been loaded.

    The default value is null.


    [read-only] locationDisplay : LocationDisplay

    The location display manages and renders the device's current location on a MapView using a data source, such as a GPS sensor.

    The device location is displayed as a blue, round symbol that is automatically refreshed by regular updates from the LocationDisplay::dataSource. Although the LocationDisplay::dataSource uses the device's location data source by default, you can configure it to use data sources such as NMEA, route tracker, indoors,and simulated data sources. For more information see AbstractLocationDataSource.

    After the MapView::map has been assigned and loaded, call LocationDisplay::start() to initiate location updates from the AbstractLocationDataSource.

    Use the Enums.LocationDisplayAutoPanMode enumerations to build navigation or compass style apps. For example, adopt LocationDisplayAutoPanModeNavigation to build an app that pans the MapView so that the current location symbol is shown near the bottom of the screen and the MapView is aligned with the direction of travel. You can also customize the symbols that display the device's location, its heading, the accuracy of the signal and the acquiring signal.


    magnifierEnabled : bool

    true if the magnifier is enabled, otherwise false.

    This method can't be called until a Map has been assigned to the MapView. If called before the map view is ready or the initialization of default magnifier fails, an Enums.ErrorTypeCommonIllegalState exception will occur.


    [default] map : Map

    The map that the MapView is displaying.

    If you assign a Map to a MapView, the map, its Basemap, and collection of operational layers automatically start to load. When loading completes, the layers and basemap are rendered in the map view. To validate the content of a map before you display it, load the Map into your app before you assign it to a MapView.


    [read-only] mapRotation : double

    Returns the rotation angle of the Map in degrees from its north-south direction.

    If the map has been rotated in a clockwise direction, the rotation value is negative. If it has been rotated in a counterclockwise direction, the value is positive. For example, if the rotation value is -90, the top of the MapView will display an eastern part of the Map. Users can interactively rotate the map using the map view's keyboard, mouse or touch rotation gestures. You can rotate the map programmatically using methods that set the Viewpoint, such as MapView::setViewpointRotation or GeoView::setViewpoint.


    [read-only] mapScale : double

    Returns the scale of the MapView.

    The scale represents the relationship between a distance in the MapView (on the screen) and the corresponding distance on the ground. For example, a scale of 100,000 indicates that one centimeter on the MapView display equates to one kilometer on the ground. Users can interactively change the scale using the map view's zooming gestures. You can set the scale programmatically using methods that set the Viewpoint, such as MapView::setViewpointScale. The value is NAN until the load status of the Map is Enums.LoadStatusLoaded and the draw status of the GeoView is Enums.DrawStatusCompleted.


    rotationByPinchingEnabled : bool

    Whether rotation of the MapView by multi-touch pinching is enabled.


    [read-only] unitsPerDIP : double

    The size of each device-independent pixel (DIP) in map units (read-only).

    This represents the spatial resolution of the MapView. The value changes according to the MapView::mapScale (it decreases as the user zooms in, for example).

    The value is NaN until the load status of the Map is Enums.LoadStatusLoaded and the draw status of the GeoView is Enums.DrawStatusCompleted.


    [read-only] visibleArea : Polygon

    Returns the visible area represents the portion of the Map that is visible in the MapView (read-only).

    When a new Map is assigned to a MapView, the default value of the visible area is set from the GeoModel::initialViewpoint.

    Users can interactively navigate the map to change the visible area, or you can programmatically change this using methods that set the Viewpoint, such as GeoView::setViewpoint.

    The visible area polygon always contains one ring with four vertices, each representing a corner of the map. It is a Polygon and not an Envelope because the map may be rotated and each corner of the map may contain unique x-y coordinates. Note that the visible area excludes the portion of the map obscured by the map view's attribution bar. As a result, the edges and center of the visible area may not coincide with the bounds and center of the MapView.


    wrapAroundMode : Enums.WrapAroundMode

    Gets the current WrapAroundMode, indicating if continuous panning across the international date line is enabled (true).

    By default, the MapView attempts to wrap the Map across the international date line for a continuous panning user experience. The eastern and western hemispheres wrap to form a continuous map, giving the impression that the map is endless.

    You can apply wraparound to a MapView if certain conditions are met, as described in WrapAroundModeEnabledWhenSupported. To remove the wraparound behavior set the value to WrapAroundModeDisabled.

    If wraparound mode is enabled, geometries returned from MapView::visibleArea may have coordinates outside the domain of the spatial reference of the map. Before using such geometries to perform spatial queries, address finding, or as feature geometries in a geodatabase, normalize them to lie within the spatial reference domain using GeometryEngine::normalizeCentralMeridian. The default value is WrapAroundModeEnabledWhenSupported.


    zoomByPinchingEnabled : bool

    Whether zooming of the MapView by multi-touch pinching is enabled.


    Signal Documentation

    allowMagnifierToPanMapChanged()

    Emitted when the allowMagnifierToPanMap property changes.

    Note: The corresponding handler is onAllowMagnifierToPanMapChanged.


    backgroundGridChanged()

    Emitted when the backgroundGrid property changes.

    Note: The corresponding handler is onBackgroundGridChanged.


    calloutDataChanged()

    Emitted when the calloutData property changes.

    Note: The corresponding handler is onCalloutDataChanged.


    [since Esri.ArcGISRuntime 200.1] geometryEditorChanged()

    Emitted when the geometryEditor property changes.

    Note: The corresponding handler is onGeometryEditorChanged.

    This signal was introduced in Esri.ArcGISRuntime 200.1.


    gridChanged()

    Emitted when the grid property changes.

    Note: The corresponding handler is onGridChanged.


    locationDisplayChanged()

    Emitted when the locationDisplay property changes.

    Note: The corresponding handler is onLocationDisplayChanged.


    magnifierEnabledChanged()

    Emitted when the magnifierEnabled property changes.

    Note: The corresponding handler is onMagnifierEnabledChanged.


    mapChanged()

    Emitted when the map property changes.

    Note: The corresponding handler is onMapChanged.


    mapRotationChanged()

    Emitted when the mapRotation property changes.

    Note: The corresponding handler is onMapRotationChanged.


    mapScaleChanged()

    Emitted when the mapScale property changes.

    Note: The corresponding handler is onMapScaleChanged.


    rotationByPinchingEnabledChanged()

    Emitted when the rotationByPinchingEnabled property changes.

    Note: The corresponding handler is onRotationByPinchingEnabledChanged.


    visibleAreaChanged()

    Emitted when the visibleArea property changes.

    Note: The corresponding handler is onVisibleAreaChanged.


    wrapAroundModeChanged()

    Emitted when the wrapAroundMode property changes.

    Note: The corresponding handler is onWrapAroundModeChanged.


    zoomByPinchingEnabledChanged()

    Emitted when the zoomByPinchingEnabled property changes.

    Note: The corresponding handler is onZoomByPinchingEnabledChanged.


    Method Documentation

    point locationToScreen(Point mapPoint)

    Converts mapPoint within the map view's spatial reference to a screen coordinate.

    The screen coordinates are in device-independent pixels (DIP) relative to the upper-left corner at position 0,0. The screen coordinates returned may lie outside the current map view bounds. For example, if a map of the world is zoomed in to the extent of Africa, a map location within South America would result in a screen coordinate that is outside the screens bounds. If the WrapAroundMode is enabled on the map view, this method returns the closest screen location matching the specified map location. If the map coordinate is in the visible area the method will return that screen coordinate, otherwise it will return the screen coordinate from the frame closest to the visible area.

    To call this method, assign a map to the map view. Ensure that it is loaded and the draw status is Enums.DrawStatusCompleted.


    Point screenToLocation(double screenX, double screenY)

    Converts screen coordinates relative to the upper-left corner of the map view to a location in map coordinates.

    To use this method, assign a map to the map view. Ensure that it is loaded and the draw status is Enums.DrawStatusCompleted.

    • screenX - The screen's x-coordinate to convert to map coordinate.
    • screenY - The screen's y-coordinate to convert to map coordinate.

    string setViewpointCenter(Point center)

    Sets the viewpoint with a center point.

    • center - The location at which to center the map view.

    Returns a task ID that can be used to cancel the setViewpointCenter task.

    See also Cancelable.


    string setViewpointCenterAndScale(Point center, double scale)

    Centers the map view at the provided center point and zooms to the given scale.

    • center - The location at which to center the map view.
    • scale - The scale at which the map is displayed.

    Returns a task ID that can be used to cancel the setViewpointCenterAndScale task.

    See also Cancelable.


    string setViewpointGeometry(Geometry boundingGeometry)

    Zooms and pans the map view to the extent of the provided geometry.

    • boundingGeometry - The geometry to zoom to.

    Returns a task ID that can be used to cancel the setViewpointGeometry task.

    See also Cancelable.


    string setViewpointGeometryAndPadding(Geometry boundingGeometry, double paddingInDIPS)

    Sets the viewpoint with a bounding geometry and padding.

    • boundingGeometry - The bounding geometry to zoom to.
    • paddingInDIPS - The minimum amount of padding around the bounding geometry in pixels.

    Returns a task ID that can be used to cancel the setViewpointGeometryAndPadding task.

    See also Cancelable.


    string setViewpointRotation(double angleDegrees)

    Rotates the map view to the provided angle.

    The angle will be normalized between 0 and 360 degrees.

    • angleDegrees - The degrees to rotate to (in counterclockwise direction).

    Returns a task ID that can be used to cancel the setViewpointRotation task.

    See also Cancelable.


    string setViewpointScale(double scale)

    Sets the viewpoint with scale.

    • scale - The scale to zoom to.

    Returns a task ID that can be used to cancel the setViewpointScale task.

    See also Cancelable.


    string setViewpointWithAnimationCurve(Viewpoint viewpoint, real durationSeconds, AnimationCurve curve)

    Animates the display to the new viewpoint using the provided animation curve.

    • viewpoint - The visible area to display in the view.
    • durationSeconds - The time for the transition animation to complete, in seconds.
    • curve - The Enums.AnimationCurve type to use.

    Returns a task ID that can be used to cancel the setViewpointWithAnimationCurve task.

    See also Cancelable.


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