Select to view content in your preferred language

elevation Profile intersection values not in order?

125
1
3 weeks ago
Paco
by
Frequent Contributor

Hello all!

I am using geometryEngine to intersect/extract values from an existing polygon graticule of elevation values, and put those values into an array and into a 'chartjs' stacked bar chart to show an elevation profile.

I've got the values I need, from console inspection,  but they are not in directional order?  they seem random?

as you can see from the thumbnails included,  as a test, I am creating the profile over high mountains and into a flat low plain.   the elevation trend should look similar to the profile i created in ArcPro(2nd image) but they show up in random order along the intersect line(1st image).   altho the values are correct.

I am using a SketchViewModel polyline to draw the temporary profile line of interest.  disregard the stacked colored subsurface geology bars, only the TOP bar value(surf/topsurf) should be the ground/surface elevation value.

here is a snippet of my code.  is there a way to make the intersection polyline read from start node to end node(left to right)?  Would there need to be some 'Sorting' of the geometry intersections?

 

 

    var surf = [];
    var bed = [];
    var base = [];

const query = surfaceLayer.createQuery();
  query.where = "1=1";
  query.geometry = lineGeom
  query.spatialRelationship = "intersects";
  query.returnGeometry = true;
  query.outFields = ["LandSurf_elev_m","topBedrx_alt_m","topBsmt_alt_m","OBJECTID"]; 

  surfaceLayer.queryFeatures(query).then(function(result) {

    result.features.forEach(function(feature) {
      if (geometryEngine.intersects(lineGeom, feature.geometry)) {
        var topsurf  = parseInt(feature.attributes.LandSurf_elev_m); 
        var topbed = parseInt(feature.attributes.topBedrx_alt_m); 
        var topbase =  parseInt(feature.attributes.topBsmt_alt_m);
          
          surf.push([topbed, topsurf]);
          bed.push([topbase, topbed]);
          base.push([topbase + -500, topbase]);
          
      }
    });

 

 

 

Paco_0-1735232835539.png

Paco_0-1735233472334.png

 

 

0 Kudos
1 Reply
Paco
by
Frequent Contributor

..I also just noticed that I may not even need 'geometryEngine.intersects' for this?  the Query/spatialRelationship = "intersects" seems to do the same thing without it?    ..but the problem persists.

0 Kudos