Thank you very much Robert, It works but it looks empty. I don't have values, is only xy values (the locations for villages).
I did: r = pointsToRaster(r, poblados, values=1) but still looks empty. Best, Manuel On 04/11/2010 01:16 p.m., Robert J. Hijmans wrote: > Manuel, > > I think this is wrong: >>> r = pointsToRaster(poblados, r) > Try: > r<- pointsToRaster(r, poblados) > > > Robert > > On Thu, Nov 4, 2010 at 11:02 AM, Manuel Spínola<mspinol...@gmail.com> wrote: >> Thank you very much Robert. >> >> I am reading the raster vignette right now. >> >> I got this error: >> >>> r = raster(corredor) >>> res(r) = 50 >>> r = pointsToRaster(poblados, r) >> Error en .pointsToMatrix(xy) : >> points should be vectors of length 2, matrices with 2 columns, or a >> SpatialPoints* object >>> pobla...@data >> x y >> 1 500577.8 1155145 >> 2 495470.2 1164700 >> 3 489082.0 1152228 >> 4 494559.3 1171489 >> 5 492094.0 1157327 >> 6 490937.9 1155423 >> 7 488748.0 1153979 >> 8 491910.8 1154378 >> 9 485430.7 1148051 >> 10 500060.9 1148109 >> 11 491212.5 1159109 >> 12 487253.9 1151491 >> 13 480244.6 1181636 >> 14 480651.1 1184371 >> 15 477555.2 1181189 >> 16 486482.8 1167946 >> 17 483764.4 1164624 >> 18 477301.6 1192979 >> 19 483737.4 1192048 >> 20 480760.2 1192652 >> 21 476126.6 1165617 >> 22 481182.4 1185941 >> >> >> Best, >> >> Manuel >> >> On 04/11/2010 11:41 a.m., Robert J. Hijmans wrote: >> >> 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<mspinol...@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 >> mspin...@una.ac.cr >> mspinol...@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@stat.math.ethz.ch >> 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 >> mspin...@una.ac.cr >> mspinol...@gmail.com >> Teléfono: (506) 2277-3598 >> Fax: (506) 2237-7036 >> Personal website: Lobito de río >> Institutional website: ICOMVIS -- *Manuel Spínola, Ph.D.* Instituto Internacional en Conservación y Manejo de Vida Silvestre Universidad Nacional Apartado 1350-3000 Heredia COSTA RICA mspin...@una.ac.cr mspinol...@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@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo