[R-sig-Geo] How to read simple raster data

Benjamin.Galuardi galuardi at mit.edu
Mon Dec 29 16:14:20 CET 2014


Hi Sharoze,

The data appear to be in hexadecimal form. I think Matlab is capable of 
importing this directly (fread??) but I'm not sure. If you need to use 
R, you might try this example:

library(fields)
hdat =  readBin('C:/Downloads/data/isola.157x458.phase', what = 'raw', 
size=1, n = 157*458)

ndat = strtoi(pdat)  # converts from hex to numeric, assuming it is 
supposed to be numeric..

image.plot(matrix(ndat, nrow=157, ncol=458))

according to the documentation, the '.surf' files are 4 byte, so change 
size=4 for those.

hope that helps,

Ben


On 12/27/2014 2:34 PM, sharoze ali wrote:
> Hi All
>
> Iam new to this convention \format " Simple raster format " . My intention
> is to use the data of the book " two-dimensional phase unwrapping theory
> algorithms and software " which is in raster format . The link for data is "
> ftp://ftp.wiley.com/sci_tech_med/phase_unwrapping/ " . Can anyone help me
> on this . I want to use/convert the *RASTER DATA TO MATRIX* so that i can
> use the my  matlab programs . Please help !!!
>
> Best Regards,
> Sharoze Ali ,
> Sharu786786 at gmail.com
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
> -- 
> ==================================================
> Benjamin Galuardi
> PhD Student
> NMFS-Seagrant Population Dynamics Fellow
> SMAST, UMass Dartmouth
> ================================================



More information about the R-sig-Geo mailing list