[R-sig-Geo] Convert from spatialpointsdataframe to spatialpoints

Robert J. Hijmans r.hijmans at gmail.com
Thu Nov 4 18:41:15 CET 2010


Manuel.

Did you try it without converting? The help file in raster says it
needs a SpatialPoints* object. The '*' is a wild card that in this
case stands for 'DataFrame'.

The answer to your question:

as(x, 'SpatialPoints')

You could find the answer to many of this type of questions by reading
the vignettes of sp and raster, and by searching the R-sig-geo help
archives, and looking at the R spatial wiki.

Robert

On Thu, Nov 4, 2010 at 10:25 AM, Manuel Spínola <mspinola10 at gmail.com> wrote:
> Dear list members,
>
>
> I am trying to create a raster from points, but I read the points from a
> shapfile, so I have the points object as a SpatialPointsDataFrame.
> To use the function pointsToRaster I need the points as SpatialPoints.
>
> How to convert a SpatialPointsDataFrame object to a SpatialPoints?
> Best,
>
> Manuel
>
>
> --
> *Manuel Spínola, Ph.D.*
> Instituto Internacional en Conservación y Manejo de Vida Silvestre
> Universidad Nacional
> Apartado 1350-3000
> Heredia
> COSTA RICA
> mspinola at una.ac.cr
> mspinola10 at gmail.com
> Teléfono: (506) 2277-3598
> Fax: (506) 2237-7036
> 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
> 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