Converting between units

725
3
11-19-2021 01:19 PM
Danik-B
New Contributor III

I'm currently using the JS API 3.x.  I need to convert between linear units and I'm wondering if there is a utility I can use within the API to facilitate this.  Basically, I need to convert meters to all possible linear units such as yards, feet...

Thanks,

0 Kudos
3 Replies
Noah-Sager
Esri Regular Contributor
0 Kudos
Danik-B
New Contributor III

Hi @Noah-Sager .  I was looking at the geometryEngine but I couldn't see a method to just convert unit values.  I don't have geometry I just have a value and need to be able to convert it to any esriUnit.  I'm sure the API has a function to do it but I couldn't find it in the reference docs.

0 Kudos
Noah-Sager
Esri Regular Contributor

Ah, ok. I was thinking the distance() method. If you just want to convert a value to a different unit type, I'm sure there's a generic javascript function or some simple math you could use in the app. I could be wrong, but I don't think we have such a function as part of the API.

0 Kudos