[R-sig-Geo] Extract Raster Data Values to Shapefile

Zivan Karaman z|v@n@k@r@m@n @end|ng |rom gm@||@com
Wed May 11 18:18:45 CEST 2022


Hi Luca,
You should perhaps have a look at the crop and mask function in the raster
or terra package.
Hope this helps!
Zivan

On Wed, May 11, 2022 at 6:09 PM <lucfrank using mail.uni-mannheim.de> wrote:

> Hello Everyone,
>
> I have a shapefile with district borders and a raster data file (.tif).
>
> How can I extract the value from the raster data onto each district in
> the shapefile?
>
> I have the exact thing I want with two shapefiles with the command:
>
> x <- st_join(x,y,join=st_overlaps,left=TRUE,largest=TRUE)
>
> This gives me the result I want. I tried to convert the .tif file to a
> shapefile, but this didn't work for me with multiple different
> solutions I found online.
>
> I would appreciate any ideas you might have.
>
> Luca
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo using r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list