Select to view content in your preferred language

Scalebar - Cannot change unitSystem

62
1
13 hours ago
Paige
by
Occasional Contributor

I am using ArcGIS Runtime & Toolkit 200.7. I have the following code in a QML file:

MapViewBackend {
        id: mapViewBackendId
        mapView: mapViewId
        Component.onCompleted: scalebarId.mapView = mapViewId
}

MapView {
        id: mapViewId

        Scalebar {
                id: scalebarId
                anchors.bottom: parent.attributionTop
                anchors.right: parent.left
                anchors.bottomMargin: 10
                anchors.rightMargin: 5
                unitSystem: Scalebar.UnitSystem.Imperial
        }
}

The code compiles and displays a map with a scalebar, but the scalebar still displays units in metric. I have checked the value of the `unitSystem` attribute via print statements -- it is properly set to imperial, but the UI still only shows metric units. What do I need to change for this to work?

1 Reply
Minnakan19
Esri Contributor

Hi @Paige,

Thanks for the report. This is a bug in the toolkit, not your code. The value reaches the Scalebar but never makes it through to the part that picks the display units, so it stays metric no matter what you set.

It will be fixed on main for 300.1 and will be back ported to the lts.next branch (200.8). If you want it on 200.7 without upgrading, the diff is small enough to apply to your local toolkit copy:

https://github.com/Esri/arcgis-maps-sdk-toolkit-qt/pull/834/changes

After that your snippet should work as written.

Thanks,
Minnakan

0 Kudos