# NOT RUN {
ctryPoly <- rgdal::readOGR('path/to/polygon.shp')
ctryRaster <- raster::raster('path/to/raster.tif')
#get the sum of nightlight pixels in the first polygon in a multipolygon
sumPolygon1 <- sum(masqVIIRS(ctryPoly, ctryRaster, 1), na.rm=T)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab