1

I have met with a problem when importing raster data of light intensity. Concretely, the following file contains raster data of Chinese nightlight intensity. I write the following command to import it:

file_temp = st_read(dsn = 'path/tif.gdb', layer = 'noflare_20131')

light = raster(file_temp)

plot(light)

link for replication data: https://www.dropbox.com/s/o8rn7cnb4a5rc6j/tif.gdb.zip?dl=0

However, it seems that I have only extracted an empty polygon into R without values of light intensity. In contrast, when importing the data into ArcGIS, it could be displayed successfully.

I guess that I should add some options to the command st_read() or raster() while have not figured out a specific solution.

1 Answer 1

3

The drivers in GDAL/OGR don't support rasters in FileGDB sources, and you should export from Arc in a different format, such as a GeoTIFF.

Command line tools show no layers for your FileGDB:

$ ogrinfo -al -so tif.gdb/
INFO: Open of `tif.gdb/'
      using driver `OpenFileGDB' successful.
$

So I am slightly surprised that R can read this:

> file_temp = st_read(dsn = './tif.gdb', layer = 'noflare_20131')
Reading layer `noflare_20131' from data source `/home/rowlings/Downloads/tif.gdb' using driver `OpenFileGDB'
Simple feature collection with 1 feature and 3 fields
geometry type:  MULTIPOLYGON
dimension:      XY
bbox:           xmin: 73.3875 ymin: 18.12917 xmax: 134.9875 ymax: 53.50417
geographic CRS: WGS 84

but it appears to be the raster bounds rather than the data itself:

> file_temp
Simple feature collection with 1 feature and 3 fields
geometry type:  MULTIPOLYGON
dimension:      XY
bbox:           xmin: 73.3875 ymin: 18.12917 xmax: 134.9875 ymax: 53.50417
geographic CRS: WGS 84
  RASTER FOOTPRINT_Length FOOTPRINT_Area                      FOOTPRINT
1   <NA>           193.95         2179.1 MULTIPOLYGON (((73.3875 18....

If there are any other vector layers in there, R can't list them and ogrinfo isn't showing them. If there are raster layers, GDAL can't read them.

More info here:

https://stackoverflow.com/questions/27821571/working-with-rasters-in-file-geodatabase-gdb-with-gdal

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.