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 a spatially referenced raster grid and a map raster reference object. This example uses projected elevation data for Mt. Washington.

[Z, R] = arcgridread('MtWashington-ft.grd','planar');

Display the data using mapshow.

figure
mapshow(Z,R,'DisplayType','texturemap')
colorbar

Define the points you want to interpolate.

x = [312829 317447 316083 311150];
y = [4913618 4912253 4904329 4904172];

Interpolate the values at the defined points.

Vinterpolated = mapinterp(Z,R,x,y)
Vinterpolated = 1×4
103 ×

    1.5240    3.6780    6.2363    2.3646

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