Hey everybody,
I was looking at geometryservice-amd | API Reference | ArcGIS API for JavaScript and noticed that there is only a constant for UNIT_SQUARE_YARDS but not for just UNIT_YARDS. Will this be added or is there a reason why there are only square yards?
Looking at the Measurement | ArcGIS API for JavaScript you are able to get the length of a line in yards, so I assume there must be a process.
Tim
Solved! Go to Solution.
Hi Tim,
I looked into how the Measurement widget handles calculating yards without invoking a geometry service.
The widget calculates the geodesic length of a line in miles, then converts that result to the proper unit using a relational table of conversion values.
For example, there are 1760 yards in a mile, so it multiples the result by 1760 for the display value.
If using meters, it will multiply the result by 1609.34 etc.
This might not be the answer you are looking for but if you have any other questions, let me know!
I think it's because you can easily convert feet to yards on the client side so they decided not to add yards to the constants list.
I'll double-check the measurement widget though.
I hoped this wasn't the answer
Hi Tim,
I looked into how the Measurement widget handles calculating yards without invoking a geometry service.
The widget calculates the geodesic length of a line in miles, then converts that result to the proper unit using a relational table of conversion values.
For example, there are 1760 yards in a mile, so it multiples the result by 1760 for the display value.
If using meters, it will multiply the result by 1609.34 etc.
This might not be the answer you are looking for but if you have any other questions, let me know!
Jonathan,
It does answer my question, because I didn't know if it was an oversight not to include yards. I'll have to go the math route then
Thanks for looking into it.
Tim