Skip to content

Instantly share code, notes, and snippets.

@tylere
Last active December 30, 2020 22:51
Show Gist options
  • Select an option

  • Save tylere/5ae5ed067d129f85f0f0815d32b12837 to your computer and use it in GitHub Desktop.

Select an option

Save tylere/5ae5ed067d129f85f0f0815d32b12837 to your computer and use it in GitHub Desktop.
Hillshade visualization of country borders.
// Copyright 2020 Google LLC.
// SPDX-License-Identifier: Apache-2.0
// Hillshade visualization of country borders.
// Code Editor: https://code.earthengine.google.com/7f5d68875d0e2d1d106685a1af2c5d4a
var fc = ee.FeatureCollection("USDOS/LSIB_SIMPLE/2017");
var edgeSize = 3e4;
var land = ee.Image(0).byte().paint(fc, edgeSize);
var distance = fc.distance(edgeSize, 1);
var edge = land.and(distance.mask());
var elevation = land.where(
edge,
distance.divide(edgeSize/(3.14159/2)).sin().multiply(edgeSize));
var hillshade = ee.Terrain.hillshade({
input:elevation.setDefaultProjection({crs:'EPSG:4326', scale:0.1}),
azimuth:90,
elevation:30
});
var blend = elevation.visualize({min:0, max:edgeSize, palette:['grey', 'lightgrey']})
.blend(hillshade.mask(0.5));
Map.addLayer(blend, {}, 'blend');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment