Hi, I'd like to know if it's currently possible to change the length units for the SketchTooltipOptions. By default, the lengths are displayed in the metric system and I wasn't able to find a way to change it to imperial units.
Thank you
Solved! Go to Solution.
Hi Fabricio.
Thanks for reaching out.
With the current release (4.25) it derives the units either from:
- if "view.map" created from WebScene/WebMap and user logged in it gets the units (metric or imperal) from the user's configuration.
- or from the unit of the spatial reference
At the moment it is not possible to change it on the SketchTooltipOptions directly, but this could change in an upcoming release.
In the meantime, a way to change the unit between metric and imperial is on the `view.map.portalItem`:
map.portalItem = new PortalItem({ portal: { units: "english" } });
or if portalItem already exist with instantiating from WebMap or WebScene:
map.portalItem.units = "english"
I hope that helps.
Hi Fabricio.
Thanks for reaching out.
With the current release (4.25) it derives the units either from:
- if "view.map" created from WebScene/WebMap and user logged in it gets the units (metric or imperal) from the user's configuration.
- or from the unit of the spatial reference
At the moment it is not possible to change it on the SketchTooltipOptions directly, but this could change in an upcoming release.
In the meantime, a way to change the unit between metric and imperial is on the `view.map.portalItem`:
map.portalItem = new PortalItem({ portal: { units: "english" } });
or if portalItem already exist with instantiating from WebMap or WebScene:
map.portalItem.units = "english"
I hope that helps.
Thanks, @SaschaBrunnerCH! It worked like a charm 👍
Note: Just noticed the portalItem "portal" property missing in the second option:
map.portalItem.portal.units = "english"
Hi,
We're facing a similar problem. We're working in the aviation industry so we'd like to show the tooltipOptions length unit in nautical miles instead of km and the labelOptions height in feet instead of meters. Area should still be shown in km^2.
Our map is not created from a portal item and I wasn't able to to find nautical-miles as an option in https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-SpatialReference.html#un...
Is there any workaround for this use case @SaschaBrunnerCH?