Using geointerp and los2

3 views (last 30 days)
John on 31 Aug 2022
Answered: Bjorn Gustavsson on 1 Sep 2022
I'm a novice with the mapping toolbox. I've read in a tiff file using readgeoraster that contains elevation data
[Z R] = readgeoraster('test.tif')
R is a mapPostingReference. When I try to use geointerp function I get the error it expects a GeographicPostingsReference.
When I'm trying to use los2(Z,R, lat1,lon1,lat2,lon1) it states that it expects to be a raster object. I'm looking to understand what I'm doing wrong and what geointerp and los2 expects as inputs.

Answers (1)

Bjorn Gustavsson
Bjorn Gustavsson on 1 Sep 2022
If you check the documentation (browse on from the help) you will see this:
load topo
Create a raster reference object associated with the topo raster grid.
R = georefcells(topolatlim,topolonlim,size(topo))
and a couple of lines further down:
Define the points you want to interpolate using latitude and longitude.
mylats = [-40 -20 20 40];
mylons = [ 42 54 38 62];
Interpolate the values at the defined points.
Vinterpolated = geointerp(topo,R,mylats,mylons)
There's also a live-script illustrating the workings.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!