Home > Software engineering >  Google Earth Engine python
Google Earth Engine python

Time:06-27

I am trying to import nighttime light data on qgis and I keep getting invalid syntax at the last line of my code (Map. centerObject(sydney, 5))

Here is my code

import ee
from ee_plugin import Map

sydney_shp_path = ('Users/macbookpro/Downloads/OpenNightLights-master 2/onl/tutorials/files/city_of_sydney_shapefile')

night_img = ee.ImageCollection("NOAA/VIIRS/DNB/MONTHLY_V1/VCMSLCFG").filterDate('2018-01-01','2018-12-31').select('avg_rad')

NL_mean = night_img.mean()


nightclass = NL_mean.gt(5).add(NL_mean.gt(50)).add(NL_mean.gt(100))
nightclass = nightclass.updateMask(nightclass.neq(0))

Map.addLayer(nightclass.clip(sydney), ({'min':1, 'max':100}, 'VIIRS 2018', 'Nightlight')
Map.centerObject(sydney, 5)

CodePudding user response:

Method Map.addLayer is not closed properly. I am guessing method takes two parameters one return value of clip and another tuple.

CodePudding user response:

Set center of map Map.setCentre()

  • Related