Main Content

mapinterp

Map raster interpolation

Description

example

Vq = mapinterp(V,R,xq,yq) interpolates the spatially referenced raster V, using bilinear interpolation. The function returns a value in Vq for each of the query points in arrays xq and yq. R is a map raster reference object that specifies the location and extent of data in V.

Vq = mapinterp(___,method) specifies alternate interpolation methods.

Examples

collapse all

Load projected elevation data and a map cells reference object for an area around Mount Washington. Specify the points you want to interpolate. Then, interpolate the values.

[Z,R] = readgeoraster('MtWashington-ft.grd');
x = [ 312829  317447  316083  311150];
y = [4913618 4912253 4904329 4904172];
Vinterpolated = mapinterp(Z,R,x,y)
Vinterpolated = 1x4 int32 row vector

   1524   3678   6236   2365

Input Arguments

collapse all

Spatially referenced raster grid, specified as numeric or logical array.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | logical

Map raster, specified as a MapCellsReference or MapPostingsReference object.

To convert a referencing matrix to a map raster reference object, use refmatToMapRasterReference.

Query point coordinates in x dimension, specified as a numeric array.

Data Types: single | double

Query point coordinates in y dimension, specified as a numeric array.

Data Types: single | double

Interpolation methods, specified as one of these values:

MethodDescription
'nearest'Nearest neighbor interpolation
'linear'Bilinear interpolation
'cubic'Bicubic interpolation
'spline'Spline interpolation

Data Types: char | string

Output Arguments

collapse all

Interpolated values, returned as a numeric array.

Introduced in R2017a