Select to view content in your preferred language

GeometryService Yards

1196
4
Jump to solution
08-26-2014 08:10 AM
TimWitt2
MVP Alum

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

0 Kudos
1 Solution

Accepted Solutions
JonathanUihlein
Esri Regular Contributor

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!

View solution in original post

0 Kudos
4 Replies
JonathanUihlein
Esri Regular Contributor

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.

TimWitt2
MVP Alum

I hoped this wasn't the answer

0 Kudos
JonathanUihlein
Esri Regular Contributor

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!

0 Kudos
TimWitt2
MVP Alum

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

0 Kudos