I downloaded a nighttime light composite satellite image (https://ngdc.noaa.gov/eog/dmsp/downloadV4composites.html#AVSLCFC) which uses a scale for light intensity from 0 (no light) to 63 (max light). I cropped it to Chinese boundaries, using a boundary shapefile in QGIS.
Because I want to use the night time light as proxy for econ activity in Chinese cities, the ultimate goal is to have a datset of 3 columns (latitute, longitude, light intensity) for each raster of my satellite image, so that I can then allocate light aggregates to Chinese cities (I have a shapefile of all Chinese city-level admin regions).
So far, I have tried the following in R:
install.packages("magick") library(magick) i <- image_read('satellite.tif') # read in the image i_array <- as.integer(i[]) # save as array (list)
I then converted the array into csv format to have a better look at it.
write.csv(china_sat_array, file = "china_sat_list.csv")
Does anyone have an idea what I'm doing wrong or an alternative how to end up with the desired three columns?