Select to view content in your preferred language

ArcGIS API for JavaScript v4 + Esri Linear Referencing REST API compatibility

519
0
07-06-2022 09:37 AM
Ed_Conrad
New Contributor III

The Esri Linear Referencing REST API samples, depicting tasks such as MeasureToGeometry and GeometryToMeasure are super powerful.  The samples use an older version of the ArcGIS API for JavaScript, v2.7; however, exchanging the script tags for v.3.41 is painless and the examples still work.  Although ArcGIS API for JavaScript underwent a major overhaul from v3 -> v4, such that the examples would need to be updated to become v4 compliant, would the Linear Referencing REST API still work if the Linear Referencing web service was published from ArcMap?   Does the Linear Referencing REST API only work with v4 of the JavaScript API if the web service is published from ArcGIS Pro?    Thank you!

 

// ArcGIS API for JavaScript v2   (samples use this one)
<link rel="stylesheet" type="text/css" href="https://serverapi.arcgisonline.com/jsapi/arcgis/2.7/js/dojo/dijit/themes/claro/claro.css"/>
<script type="text/javascript" src="https://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.7"></script>


// ArcGIS API for JavaScript v3  (samples still work with this)
<link rel="stylesheet" href="https://js.arcgis.com/3.41/esri/css/esri.css">
<script src="https://js.arcgis.com/3.41/"></script>

// ArcGIS API for JavaScript v4   (would samples still work if code was v4 compliant?)
<link rel="stylesheet" href="https://js.arcgis.com/4.24/esri/themes/dark/main.css">
<script src="https://js.arcgis.com/4.24/"></script>

//  Can these work in an JavaScript API 4 world? 
var soeURL = "https://[server] /rest/services/[folder]/[service name]/MapServer/exts/LRSServer/networkLayers/0/geometryToMeasure";

var soeURL = "https://[server] /rest/services/[folder]/[service name]/MapServer/exts/LRSServer/networkLayers/0/measureToGeometry";

0 Kudos
0 Replies