Select to view content in your preferred language

Get Total length of polyline feature Layer

158
1
05-12-2025 10:57 AM
Vakhtang_Zubiashvili
Frequent Contributor

Hi all,

i want to get total length of my feature layer, i use API version 4. 27.

I tried this code:

   view.when(function() {
          var length = geometryEngine.geodesicLength(wyalmomaragebareabilitaciebi2025, "meters");
          console.log("Polyline length (meteres): ", length);
        });

 

but it did not work, i get ERRORUncaught (in promise) TypeError: Cannot read properties of null (reading 'B')

I can do it using query, but it slows load time, help please.

 

Thank you

0 Kudos
1 Reply
Edvinas_S
Esri Contributor

Input for geodesicLength() is a geometry, not a feature layer: geometryEngine | API Reference | ArcGIS Maps SDK for JavaScript 4.32 | Esri Developer

You should query a feature from your layer, get feature.geometry and pass it to geodesicLength()

0 Kudos