Download your GEE map as jpg

Create a nice maps for a report

Draw a geometry and use the code below or follow this link.


var lights = ee.ImageCollection("NOAA/DMSP-OLS/NIGHTTIME_LIGHTS");
var viirs = ee.ImageCollection("NOAA/VIIRS/DNB/MONTHLY_V1/VCMSLCFG");

var virs = viirs.select("avg_rad").filterDate(ee.Date.fromYMD(2017,1,1),ee.Date.fromYMD(2017,12,31)).mean();

// vizualization parameters
var viz = {min:0, max:100, palette:['000000,700000,808080,FFFF00,ffffff']};

var bound = geometry.bounds();

var myList = ee.List(bound.coordinates().get(0));

var xmin = ee.Number(ee.List(myList.get(0)).get(0));
var xmax = ee.Number(ee.List(myList.get(1)).get(0));
var ymin = ee.Number(ee.List(myList.get(0)).get(1));
var ymax = ee.Number(ee.List(myList.get(3)).get(1));

var pixSize = 500;

var xs = ee.String(ee.Number(ee.Geometry.LineString([[xmin,ymin],[xmax,ymin]]).length()).divide(pixSize).toInt());
var ys = ee.String(ee.Number(ee.Geometry.LineString([[xmin,ymin],[xmin,ymax]]).length()).divide(pixSize).toInt());

var dimension = ee.String(xs.cat("x").cat(ys));
var img = virs.visualize({bands:"avg_rad",
min:0,
max:100,
palette:['000000','700000','808080','FFFF00','ffffff'],
forceRgbOutput:true});

print(img.getThumbURL({dimensions:dimension.getInfo(),
region:bound.getInfo(),
format:"jpg"}));

Map.addLayer( virs,viz,"1992");

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s