Search code examples
qtqmlarcgisqqmlcomponentarcgis-runtime

How to add ScaleBarOverlay into arcgis map


enter image description here

Above screenshot is done using custom Scalebar Component, i am wondering to resize scale bar on zoom in and zoom out of Mapview.

ScaleBar{                
        anchors.left: mapView.left
        anchors.bottom: mapView.bottom
        anchors.bottomMargin: 80
        anchors.margins: 10 * scaleFactor
        map:mapView
           }



  QtObject {
        id: internal

        property real segmentWidth: scaleBar.width / 4
        property real segmentHeight: scaleBar.width * 0.05
}

Setting Width and height of the scale bar like this but how can i set width dynamically it should expand width on zoom out

Fallowed this example to create scalebar https://community.esri.com/thread/201990-scale-bar

Added this component in ArcGis Mapview.

What needs to be import to use ScaleBarOverlay in ARCGIS map?

I tried importing Esri.ArcGISRuntime 100.7

ScaleBarOverlay scaleBarOverlay = new ScaleBarOverlay()
mapView.addMapOverlay(scaleBarOverlay)

It says unknown component M300


Solution

  • Got solution by setting map.scale to the width of scale bar