Mapping Toolbox | ![]() ![]() |
Geographic Interpolation
When using vector data, you must be careful when you make assumptions concerning geographic reality between data points. For instance, when plotting vector data, you might connect each point with a straight line segment. This does not usually indicate any true knowledge about the region between known points. Data consisting of points along a coastline might be sparse; in the absence of other knowledge, filling in data can be misleading.
Despite the dangers of misinterpretation, many circumstances exist in which geographic data interpolation is useful or necessary. Sparser data can be linearly filled-in with the interpm
function.
Consider a set of latitude and longitude points that you want to be no further than one degree in separation in either direction:
lats = [1 2 4 5]; longs = [1 3 4 5]; maxdiff = 1; [newlats,newlongs] = interpm(lats,longs,maxdiff) newlats = 1.0000 1.5000 2.0000 3.0000 4.0000 5.0000 newlongs = 1.0000 2.0000 3.0000 3.5000 4.0000 5.0000
In the original lats
, there is a gap of 2 degrees between the 2 and the 4. A linearly interpolated point, (3,3.5) was therefore inserted in newlats
and newlongs
. Similarly, in the original longs
, there is a gap of 2 degrees between the 1 and the 3. The point (1.5,2) was therefore interpolated and placed into newlats
and newlongs
. Now, no adjacent points in either newlats
or newlongs
is greater than maxdiff
in separation.
The interpm
function returns the original data with new linearly interpolated points inserted. Sometimes, however, only the interpolated values are desired. The commands intrplat
and intrplon
provide a capability similar to the MATLAB interp1
command, allowing for different methods of interpolation.
Use intrplat
to interpolate a latitude for a given longitude. Given a monotonic set of longitudes and their matching latitude points, you can interpolate a new latitude for a given longitude in a linear, spline, cubic, rhumb line, or great circle sense.
Here, find the latitude corresponding to a longitude of 7.3° in the following data in a linear, great circle, and rhumb line sense:
longs = [1 3 4 9 13]; lats = [57 68 60 65 56]; newlong = 7.3; newlat = intrplat(longs,lats,newlong,'linear') newlat = 63.3000 newlat = intrplat(longs,lats,newlong,'gc') newlat = 63.5029 newlat = intrplat(longs,lats,newlong,'rh') newlat = 63.3937
The intrplon
function provides the same capability for interpolating new longitudes for given latitudes.
![]() | Creating Vector Data | Polygon Area | ![]() |