Select to view content in your preferred language

Measures in the JavaScript API

1514
3
04-09-2017 01:19 AM
PaulLohr
Frequent Contributor

Hello,

Is it possible to access measures (M enabled geometry) in the JavaScript API, from a service provided by ArcGIS Server? I don't know if ArcGIS Server can provide information about measures to the application. It could be any version of ArcGIS Server. The user experience could be something like an identify button where measure and offset is returned to the user. 

Thank you in advance for any help. I haven't found this information in the documentation or forum.

0 Kudos
3 Replies
thejuskambi
Frequent Contributor

Which version of the javascript api are you using. if it is 4.x then, the api does support it and can be accessed through the geometries directly. Here is details for Point

Point | API Reference | ArcGIS API for JavaScript 4.3 

If you are using 3.X, There is no direct support for you to be able to get the M values. However, you could use the "esri/request" object and query the layer directly from REST service. The ArcGIS Server 10.1 and higher has support to return the Z and M values.

PaulLohr
Frequent Contributor

Thank you for helping me with this, Thejus. I have not started on the project but wanted to find out if measures could be retrieved. Likely to use version 4.x. The link to documentation was helpful. Although, I should have mentioned that I plan to work with polylines. Should I use the paths property of polyline to retrieve an M value (measure)? 

Polyline | API Reference | ArcGIS API for JavaScript 4.3 

Thank you also for answering the question about ArcGIS Server.

0 Kudos
thejuskambi
Frequent Contributor

I understand that, I just shared the Points link just as a example that, Z and M values are available in 4.x version.

You could use the paths to get the m values, but then you would be working with array objects. Another approach would be to get Points from the Polyline object using the "getPoint" method.

Polyline | API Reference | ArcGIS API for JavaScript 4.3 

0 Kudos