TransWikia.com

Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘getValues’ for signature

Geographic Information Systems Asked by Manish1013 on February 27, 2021

I was trying to convert the raster to vector/matrix using getValues and I am getting this error:

Error in (function (classes, fdef, mtable)  : unable to find an inherited method for function ‘getValues’ for signature ‘"character", "missing", "missing"

I have put the code below for reference.

#mosaic

Mosaic<- "Mosaic.tif"

#shapefile

shp <- "Tahsil Boundary2001.shp"

#Extacted Raster

gondia<- "extract.tif"

#convert raster to vectormatrix

nr <- getValues(gondia)

One Answer

I suppose that you want to use getValues from raster package. You have to create raster object with raster() function. In your case you just store string "extract.tif" into variable gondia so:

gondia <- "extract.tif"
gondia

results in

[1] "extract.tif"

Just try:

gondia <- raster("extract.tif")
nr <- getValues(gondia)

For further details see getValues documentation.

Correct answer by Oto Kaláb on February 27, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP