Skip to content

Instantly share code, notes, and snippets.

@KMarkert
Created August 15, 2020 16:16
Show Gist options
  • Save KMarkert/39f1af2eafc9e5574909ad9432b1106d to your computer and use it in GitHub Desktop.
Save KMarkert/39f1af2eafc9e5574909ad9432b1106d to your computer and use it in GitHub Desktop.
using PyCall;
# import the ee Python module into Julia
# and initialize the EE API
ee = pyimport("ee");
ee.Initialize();
# load in ee.Image and sample a point
dem = ee.Image("USGS/SRTMGL1_003");
xy = ee.Geometry.Point([86.9250, 27.9881]...);
# notice the ellipsis after the coordinate list
# this is splatting, allowing for users pass
# unknown number of arguments as an array from an iterable
elev = dem.sample(xy, 30).first().get("elevation").getInfo();
println("Mount Everest elevation (m): ", elev);
# result should be: 'Mount Everest elevation (m): 8729'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment