Thank you very Mathieu. Best,
Manuel 2012/5/24 Mathieu Rajerison <mathieu.rajeri...@gmail.com> > Hi, > > It surely is... > > You could transform lu$COB_AGROP as numeric like this: > lu$COB_AGROP_num <- as.numeric(as.factor(lu$COB_AGROP)) > > lur = rasterize(lu, crr, field = "COB_AGROP_num") > > Best, > > Mathieu > > 2012/5/24 Manuel Spínola <mspinol...@gmail.com> > >> Dear list members, >> >> I am trying to make a raster from a shapefile that I imported to r using >> the function "readOGR". When I use the function rasterize and try to plot >> the object nothing is plotted. Is this happening because the field is >> categoric (factor) and not numeric? >> >> > cr = >> >> readOGR(dsn="/Users/manuelspinola/Documents/ProyectosRespacial/EvalHab_reporte", >> layer="Cr_wgs84_meso") >> >> > crproy = spTransform(cr, CRS("+proj=tmerc +lon_0=-84 +lat_0=0 >> +x_0=500000 >> +k=0.9999 +datum=WGS84")) >> >> > lu = >> >> readOGR(dsn="/Users/manuelspinola/Documents/ProyectosRespacial/Ecologia_del_paisaje", >> layer="usosuelos2006_cr05") >> >> > crr = raster(crproy) >> >> > lur = rasterize(lu, crr, field = "COB_AGROP") >> Found 157480 region(s) and 227521 polygon(s) >> Mensajes de aviso perdidos >> 1: In .polygonsToRaster(x, y, ...) : selected field is character type >> 2: In .polygonsToRaster(x, y, ...) : NAs introducidos por coerción >> >> > lur >> class : RasterLayer >> dimensions : 10, 10, 100 (nrow, ncol, ncell) >> resolution : 37190.08, 35181.17 (x, y) >> extent : 286586.4, 658487.2, 889526.4, 1241338 (xmin, xmax, ymin, >> ymax) >> coord. ref. : +proj=tmerc +lon_0=-84 +lat_0=0 +x_0=500000 +k=0.9999 >> +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0 >> values : in memory >> min value : NA >> max value : NA >> >> plot(lur) >> >> 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@r-project.org >> 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 <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@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo