2

I'm currently having some problem while trying to create a GTiFF file.

require(raster)
require(sp)
require(rgdal)
require(gdalUtils)
library(rgeos)

map <- readOGR ('MyShapefile.shp',layer='MyShapefile')
grid <- paste(sortie,"grid.tif",sep="")
gdal_grid(src_datasource='MyShapefile.shp',dst_filename=grid,zfield='In_ATMO',a="invdist:power=2.0:smoothing=1.0",of="GTiff",ot="Float32",l=mod,output_Raster=T)
sauv<-paste(sortie,"test_In_ATMO.tif",sep="")
gdalwarp(srcfile=grid,dstfile=sauv,tr=c(7.0,7.0),of="GTiff",ot="Float32",overwrite=T)

This is the code sample I use to create my GTiFF file, but it really looks like it isn't in an high definition.

gtiff

My csv data looks like this

long;lat;In_ATMO
55557754;14454489;4
......

And with this data I create a ShapeFile that I use to create a GTiFF file. if asked, I can share those files to help answering my question..

Is there anyone who knows how can I get a better definition for my Tiff ?

0

If you want to have finer resolution, gdalUtils::gdal_grid() has an option outsize to define output dimensions.

You might have noticed gdal_grid(), returns message like:

class       : RasterBrick 
dimensions  : 256, 256, 65536, 1  (nrow, ncol, ncell, nlayers)

(The output was RasterBrick as you have specified by output_Raster=T).

Then you can double nrow and ncol by giving an outsize = c(512, 512). Borrowing your example, it would be:

gdal_grid(src_datasource='MyShapefile.shp',dst_filename=grid,zfield='In_ATMO',
          a="invdist:power=2.0:smoothing=1.0", outsize = c(512, 512), 
          of="GTiff", ot="Float32", l=mod, output_Raster=T)

And the output raster is in higher definition:

class       : RasterBrick 
dimensions  : 512, 512, 262144, 1  (nrow, ncol, ncell, nlayers)

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.