writeRaster error: unknown file format
Paulo, Thank you. This has been fixed now on R-Forge. The problem was with the (new) default (that I am starting to regret) of using FLT8S (64 bit floats) for writing to files. IDRISI does not support that; this has now been caught. In the current version, something like this should work (explicitly setting the data type): writeRaster(band, filename = 'D:\\l8_b2.rst', format = 'RST', datatype='FLT4S', overwrite =TRUE) Robert
On Mon, Jan 27, 2014 at 5:01 PM, pecardoso <pauloeducardoso at gmail.com> wrote:
Robert,
Thank you for your message. First thing, raster package is simply amazing.
I've installed raster v2.2-16.
I've imported the TIF from the dropbox link with
i.l8 <- raster('D:\\Dropbox\\Public\\LC81810682013122LGN01_B2.TIF',
package = "raster")
i.l8
class : RasterLayer dimensions : 7311, 7521, 54986031 (nrow, ncol, ncell) resolution : 30, 30 (x, y) extent : 370485, 596115, -1388715, -1169385 (xmin, xmax, ymin, ymax) coord. ref. : +proj=utm +zone=33 +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0 data source : D:\Dropbox\Public\LC81810682013122LGN01_B2.TIF names : LC81810682013122LGN01_B2 values : 0, 65535 (min, max) I'm also able to generate a RST file from the rasterLayer i.l8 with writeRaster(band, filename = 'D:\\l8_b2.rst', format = 'IDRISI', overwrite = TRUE) IDRISI Taiga can read the RST file but the file format is tagged as "IDRISI x A1" and not "IDRISI Raster A1" I still not being able to generate the RST file with writeRaster(band, filename = 'D:\\l8_b2.rst', format = 'RST', overwrite = TRUE) Error in .local(.Object, ...) : Unable to create dataset But it works fine with writeGDAL: writeGDAL(as(i.l8, "SpatialGridDataFrame"), fname = "D:\l8_gdal.rst", drivername = "RST") IDRISI Taiga read it and tag the file format as "IDRISI Raster A1", just like the ones generated internally with import functions from IDRISI. writeRaster with format = 'IDRISI' generetes a 230,732 MB idrisi file while a 214,790 MB file is generated with writeGDAL and drivername = 'RST' I can't figure out why. Paulo Eduardo Cardoso 2014-01-27 Robert Hijmans [via R-sig-geo] < ml-node+s2731867n7585643h37 at n2.nabble.com>
Paulo,
This has been fixed in raster 2.2-16 (development version). You can
install and try it:
install.packages("raster", repos="http://R-Forge.R-project.org")
Robert
On Fri, Jan 24, 2014 at 7:53 AM, pecardoso <[hidden email]<http://user/SendEmail.jtp?type=node&node=7585643&i=0>>
wrote:
Hello all. Thanks for your time. Robert, True about format, but 'IDRISI' file format is also there and
I've
used format = 'IDRISI' ultil recently, and it was working just fine with exactly the same procedure. About running scripts from RStudio and R console, I'm not skilled enough
to
understand the differences. in my system, writeFormats() returns: name long_name [1,] "raster" "R-raster" [2,] "SAGA" "SAGA GIS" [3,] "IDRISI" "IDRISI" ... [36,] "RST" "Idrisi Raster A.1" With older versions of raster package, the argument format='IDRISI' also produced 'IDRISI Raster A.1' files. Latest version in fact is not accepting format = 'IDRISI' for the RasterLayer created from reading the 16 bis Landsat TIF file and is returning the error: Error in .setFileExtensionHeader(filename, filetype) : unknown file
format
Changing to format = 'RST' isn't better. I get the error: Error in .local(.Object, ...) : Unable to create dataset The behavior is the same running this from within RStudio and from the
R
console. Maybe with the same data it would be better, or reproducible. Here <https://www.dropbox.com/s/is2td4t6uwc44fq/LC81810682013122LGN01_B2.TIF>
the link to the landast image (107Mb).
For the resulting RasterLayer
GDALinfo('...\\LC81810682013122LGN01_B2.tif')
rows 7311
columns 7521
bands 1
lower left origin.x 370485
lower left origin.y -1388715
res.x 30
res.y 30
ysign -1
oblique.x 0
oblique.y 0
driver GTiff
projection +proj=utm +zone=33 +datum=WGS84 +units=m +no_defs
file C:\Users\Strix\Downloads\LC81810682013122LGN01_B2.tif
apparent band summary:
GDType hasNoDataValue NoDataValue blockSize1 blockSize2
1 UInt16 FALSE 0 1 7521
apparent band statistics:
Bmin Bmax Bmean Bsd
1 0 65535 NA NA
Metadata:
AREA_OR_POINT=Point
Warning message:
statistics not supported by this driver
Eddie, I generally do not use setwd when sharing scripts with
colleagues. I
usually define paths to some shared folder. It's not working anyway.
From my
sessionInfo string you will se that I'm running rgdal. Could it be something with rgdal (and gdal) installation after package update? For a similar problem <
users suggests re-install of rgdal, gdal and its libraries. -- View this message in context:
Sent from the R-sig-geo mailing list archive at Nabble.com.
_______________________________________________ R-sig-Geo mailing list [hidden email] <http://user/SendEmail.jtp?type=node&node=7585643&i=1> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
_______________________________________________ R-sig-Geo mailing list [hidden email] <http://user/SendEmail.jtp?type=node&node=7585643&i=2> https://stat.ethz.ch/mailman/listinfo/r-sig-geo ------------------------------ If you reply to this email, your message will be added to the discussion below: http://r-sig-geo.2731867.n2.nabble.com/writeRaster-error-unknown-file-format-tp7585627p7585643.html To unsubscribe from writeRaster error: unknown file format, click here<http://r-sig-geo.2731867.n2.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=7585627&code=cGF1bG9lZHVjYXJkb3NvQGdtYWlsLmNvbXw3NTg1NjI3fDIxMDEwOTczNDM=> . NAML<http://r-sig-geo.2731867.n2.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
-- View this message in context: http://r-sig-geo.2731867.n2.nabble.com/writeRaster-error-unknown-file-format-tp7585627p7585646.html Sent from the R-sig-geo mailing list archive at Nabble.com.
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo