Compatibility between sf and raster

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Compatibility between sf and raster

Manuel Spínola
Dear list members,

Is there any plan to make compatible the sf and the raster packages?

library(sf)
library(raster)

> nc <- st_read(system.file("shape/nc.shp", package="sf"))
Reading layer `nc' from data source
`/Library/Frameworks/R.framework/Versions/3.4/Resources/library/sf/shape/nc.shp'
using driver `ESRI Shapefile'
Simple feature collection with 100 features and 14 fields
geometry type:  MULTIPOLYGON
dimension:      XY
bbox:           xmin: -84.32385 ymin: 33.88199 xmax: -75.45698 ymax:
36.58965
epsg (SRID):    4267
proj4string:    +proj=longlat +datum=NAD27 +no_defs

> raster(nc)
Error in (function (classes, fdef, mtable)  :
  unable to find an inherited method for function ‘raster’ for signature
‘"sf"’



--
*Manuel Spínola, Ph.D.*
Instituto Internacional en Conservación y Manejo de Vida Silvestre
Universidad Nacional
Apartado 1350-3000
Heredia
COSTA RICA
[hidden email] <[hidden email]>
[hidden email]
Teléfono: (506) 8706 - 4662
Personal website: Lobito de río <https://sites.google.com/site/lobitoderio/>
Institutional website: ICOMVIS <http://www.icomvis.una.ac.cr/>

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: Compatibility between sf and raster

edzer
Right now you'll have to be satisfied with doing

raster(as(nc, "Spatial"))

there is a follow-up project to sf, called stars [1], which will try to
look beyond raster, rather than redo raster or make raster and sf
compatible. Stars will consider compatibility with raster, but don't
hold your breath.

stars development will start soon.

[1] https://github.com/r-spatial/stars

On 29/08/17 17:03, Manuel Spínola wrote:

> Dear list members,
>
> Is there any plan to make compatible the sf and the raster packages?
>
> library(sf)
> library(raster)
>
>> nc <- st_read(system.file("shape/nc.shp", package="sf"))
> Reading layer `nc' from data source
> `/Library/Frameworks/R.framework/Versions/3.4/Resources/library/sf/shape/nc.shp'
> using driver `ESRI Shapefile'
> Simple feature collection with 100 features and 14 fields
> geometry type:  MULTIPOLYGON
> dimension:      XY
> bbox:           xmin: -84.32385 ymin: 33.88199 xmax: -75.45698 ymax:
> 36.58965
> epsg (SRID):    4267
> proj4string:    +proj=longlat +datum=NAD27 +no_defs
>
>> raster(nc)
> Error in (function (classes, fdef, mtable)  :
>   unable to find an inherited method for function ‘raster’ for signature
> ‘"sf"’
>
>
>
--
Edzer Pebesma
Institute for Geoinformatics  (ifgi),  University of Münster
Heisenbergstraße 2, 48149 Münster, Germany; +49 251 83 33081
Journal of Statistical Software:   http://www.jstatsoft.org/
Computers & Geosciences:   http://elsevier.com/locate/cageo/


_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

signature.asc (484 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Compatibility between sf and raster

Manuel Spínola
Thank you very much Edzer.

Manuel

2017-08-29 10:22 GMT-06:00 Edzer Pebesma <[hidden email]>:

> Right now you'll have to be satisfied with doing
>
> raster(as(nc, "Spatial"))
>
> there is a follow-up project to sf, called stars [1], which will try to
> look beyond raster, rather than redo raster or make raster and sf
> compatible. Stars will consider compatibility with raster, but don't
> hold your breath.
>
> stars development will start soon.
>
> [1] https://github.com/r-spatial/stars
>
> On 29/08/17 17:03, Manuel Spínola wrote:
> > Dear list members,
> >
> > Is there any plan to make compatible the sf and the raster packages?
> >
> > library(sf)
> > library(raster)
> >
> >> nc <- st_read(system.file("shape/nc.shp", package="sf"))
> > Reading layer `nc' from data source
> > `/Library/Frameworks/R.framework/Versions/3.4/
> Resources/library/sf/shape/nc.shp'
> > using driver `ESRI Shapefile'
> > Simple feature collection with 100 features and 14 fields
> > geometry type:  MULTIPOLYGON
> > dimension:      XY
> > bbox:           xmin: -84.32385 ymin: 33.88199 xmax: -75.45698 ymax:
> > 36.58965
> > epsg (SRID):    4267
> > proj4string:    +proj=longlat +datum=NAD27 +no_defs
> >
> >> raster(nc)
> > Error in (function (classes, fdef, mtable)  :
> >   unable to find an inherited method for function ‘raster’ for signature
> > ‘"sf"’
> >
> >
> >
>
> --
> Edzer Pebesma
> Institute for Geoinformatics  (ifgi),  University of Münster
> Heisenbergstraße 2, 48149 Münster, Germany; +49 251 83 33081
> Journal of Statistical Software:   http://www.jstatsoft.org/
> Computers & Geosciences:   http://elsevier.com/locate/cageo/
>
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>



--
*Manuel Spínola, Ph.D.*
Instituto Internacional en Conservación y Manejo de Vida Silvestre
Universidad Nacional
Apartado 1350-3000
Heredia
COSTA RICA
[hidden email] <[hidden email]>
[hidden email]
Teléfono: (506) 8706 - 4662
Personal website: Lobito de río <https://sites.google.com/site/lobitoderio/>
Institutional website: ICOMVIS <http://www.icomvis.una.ac.cr/>

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo