Select to view content in your preferred language

Scalebar - Cannot change unitSystem

123
2
Jump to solution
2 weeks 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 Solution

Accepted Solutions
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

View solution in original post

2 Replies
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

Paige
by
Occasional Contributor

Thank you Minnakan! I tried applying the fix locally and it worked. I'll keep an eye out for the long term fix and will be sure to upgrade when it comes through.