[R-sig-Geo] converting dataframe to rasterformate

Edzer J. Pebesma e.pebesma at geo.uu.nl
Thu Mar 8 19:28:16 CET 2007


Paul, that is hard to see from here. Perhaps you could make the points 
available? Is the grid aligned with x and y? Did something happen with 
(re)projection inbetween?
--
Edzer

Paul Magdon wrote:

>First of all thank you very much for this comments.
>
>As you already stated the points have to be regular spaced.
>I expected them to be regular, because the dataset was created with the
>pixel to ascii function within Erdas Imagine.
>But I got the following error notice:
>
>
>gridded(qb.train) <- TRUE
>suggested tolerance minimum: 0.838128330817305Fehler in
>points2grid(points, tolerance) : dimension 1 : coordinate intervals are
>not constant
>
>How can they become irregular, I was not changing the X &Y columns?
>
>Paul
>
>
>
>Roger Bivand schrieb:
>  
>
>>On Thu, 8 Mar 2007, Paul Magdon wrote:
>>
>>    
>>
>>>Hello,
>>>I'm using R for classifying remote sensed data. I finally managed to apply
>>>different knn-methods to the data. Now I have a Dataframe with X, Y, and Z
>>>columns.
>>>Exp.:
>>>  X             Y       Z
>>>475477.1  7485303.29  46.62
>>>
>>>
>>>Is there an easy way to export such dataframe into am Esri compatible
>>>format like Arcgrid, img, tiff etc.??
>>>
>>>      
>>>
>>Yes, for example:
>>
>>library(sp)
>>data(meuse.grid)
>>class(meuse.grid)
>>names(meuse.grid)
>>coordinates(meuse.grid) <- c("x", "y")
>>class(meuse.grid)
>>gridded(meuse.grid) <- TRUE
>>class(meuse.grid)
>>fullgrid(meuse.grid) <- TRUE
>>class(meuse.grid)
>>library(rgdal)
>>writeGDAL(meuse.grid["dist"], "dist.tif", drivername="GTiff")
>>
>>This of course will not work if the points are not regularly spaced;
>>there are plenty of different drivers for GDAL. For OSX either install
>>rgdal on GDAL/PROJ.4 from source (see Rgeo site linked from Spatial Task
>>View on CRAN for details) or write an Arc ASCII grid using
>>writeAsciiGrid() in the maptools package, which does not depend on
>>external libraries.
>>
>>Roger
>>
>>    
>>
>>>Many thanks,
>>>
>>>Paul
>>>
>>>_______________________________________________
>>>R-sig-Geo mailing list
>>>R-sig-Geo at stat.math.ethz.ch
>>>https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>>
>>>      
>>>
>
>--
>
>_______________________________________________
>R-sig-Geo mailing list
>R-sig-Geo at stat.math.ethz.ch
>https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>  
>




More information about the R-sig-Geo mailing list