-1

I need to create a cross section and chart from it in Google Earth Engine. Here is an example that has been done using QGIS. Please find the image below - Cross section of a river dem How can I do that?

  • 1
    Why does it have to be GEE? What have you tried so far? What did googling yield? – Erik Mar 26 '19 at 13:24
2

You could try something like this:

// add variables
var CrossSection = CrossSection; // draw a single lineString without corners
var numbPoints = 5000; // spacing in lat/lon between the sample points

// Get a point value along the line every ... meters
var point1 = ee.List(CrossSection1.coordinates().get(0));
var point2 = ee.List(CrossSection1.coordinates().get(1));
var XmapList = ee.List.sequence(point1.get(0), point2.get(0), null, numbPoints);
var YmapList = ee.List.sequence(point1.get(1), point2.get(1), null, numbPoints);

// Construct a feature collection with points equally spaced
var points = ee.FeatureCollection(XmapList.map(function(Xcoord){
  var Ycoord = YmapList.get(XmapList.indexOf(Xcoord));
  return ee.Feature(ee.Geometry.Point([Xcoord, Ycoord]));
}));

// Calculate the elevation at every location
var DEMIMAGE = ee.Image('AHN/AHN2_05M_INT'); // load an image with elevation
var elevation = DEMIMAGE.reduceRegions(points, ee.Reducer.first(), 10);
print(ui.Chart.feature.byFeature(elevation));

Example script with to different DEMs: Link script

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.