[prev in list] [next in list] [prev in thread] [next in thread] 

List:       r-sig-geo
Subject:    Re: [R-sig-Geo] extract value of raster attribute with polygon
From:       Fernando Gimeno <fe.gimeno () gmail ! com>
Date:       2016-07-12 19:22:04
Message-ID: CACs6gjW1utpF9WdVeg8Cj9=KaZHJ9fFiOHGF6E54MDLqqXP_GA () mail ! gmail ! com
[Download RAW message or body]

many thank.

i have a raster with attribute table of seven attributes, i want only
extract the sum value of one attribute with a poligon. I need assign value
in attribute table for those  poligon

2016-07-11 23:07 GMT-03:00 Bacou, Melanie <mel@mbacou.com>:

> Also when summarizing classified rasters, it is usual to use the `mode`
> function (instead of `sum`) since you're typically interested in the
> dominant class.
>
>
> On 7/11/2016 5:48 PM, Fernando Gimeno wrote:
>
>> i have a raster with attribute table and i need extract values with a
>> polygon. Help me please.
>>
>> COMUNAS<-shapefile("COMUNAS.shp")
>> RAST<-raster("raster_23052016/for_GDB/comb_viii.tif")
>>
>> COMUNAS<-spTransform(COMUNAS,CRS("+proj=utm +zone=18 +south +ellps=WGS84
>> +datum=WGS84 +units=m +no_defs"))
>>
>> dbf<-read.dbf("raster_23052016/for_GDB/comb_viii.tif.vat.dbf")
>>
>> r <- ratify(RAST)
>> rat <- levels(r)[[1]]
>> rat<-c(rat,dbf)
>> rat<-as.data.frame(rat)
>> levels(r) <- rat
>>
>> COMUNAS$BAL_CO2_CO <- extract(r, COMUNAS, fun = sum, na.rm = TRUE)
>>
>>
>


-- 
*Fernando J. Gimeno Molina*
*Licenciado en Geografía, Universidad de Chile*
*Geógrafo, Universidad de Chile*
*Mc(c) Gestión y Planificación Ambiental, Universidad de Chile*
*Diploma en Geomática Aplicada, Universidad de Chile*

	[[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic