Thread Subject: River miles

Subject: River miles

From: Travis

Date: 17 Nov, 2008 23:01:54

Message: 1 of 26

I have a file with data at lat/longs, and a file with River miles at lat/longs. How can I interpolate the River mile onto the data. I have tried using interp2, but that has been hugely unsuccessful. Please keep in mind that the river meanders and frequently doubles back on itself in both latitude and longitude.

Subject: River miles

From: NZTideMan

Date: 18 Nov, 2008 01:13:06

Message: 2 of 26

On Nov 18, 12:01 pm, "Travis" <sinuso...@hotmail.com> wrote:
> I have a file with data at lat/longs, and a file with River miles at lat/longs. How can I interpolate the River mile onto the data. I have tried using interp2, but that has been hugely unsuccessful. Please keep in mind that the river meanders and frequently doubles back on itself in both latitude and longitude.

Lets say you have s(x,y) river miles, where x and y are the long and
lat respectively, and you want to find s for a particular xp, yp.
You need to split your problem into two parts:
1. Find the segment in x,y where xp,yp lies by firstly finding the
segments where the normal from xp,yp is inside the segment and
secondly by minimising the distance of the normal to each of those
segments.
2. Interpolate on s within the optimal segment.

Subject: River miles

From: Travis

Date: 18 Nov, 2008 05:43:01

Message: 3 of 26

NZTideMan <mulgor@gmail.com> wrote in message <4521b8d9-2021-4ff0-b430-08822a0ce2bc@s9g2000prm.googlegroups.com>...
> On Nov 18, 12:01 pm, "Travis" <sinuso...@hotmail.com> wrote:
> > I have a file with data at lat/longs, and a file with River miles at lat/longs. How can I interpolate the River mile onto the data. I have tried using interp2, but that has been hugely unsuccessful. Please keep in mind that the river meanders and frequently doubles back on itself in both latitude and longitude.
>
> Lets say you have s(x,y) river miles, where x and y are the long and
> lat respectively, and you want to find s for a particular xp, yp.
> You need to split your problem into two parts:
> 1. Find the segment in x,y where xp,yp lies by firstly finding the
> segments where the normal from xp,yp is inside the segment and
> secondly by minimising the distance of the normal to each of those
> segments.
> 2. Interpolate on s within the optimal segment.


I have tried seperating the lat and long and using interp 1, but since it double back on itself, the values are not distinct, and it doesn't work.

Subject: River miles

From: NZTideMan

Date: 18 Nov, 2008 08:43:03

Message: 4 of 26

On Nov 18, 6:43 pm, "Travis" <sinuso...@hotmail.com> wrote:
> NZTideMan <mul...@gmail.com> wrote in message <4521b8d9-2021-4ff0-b430-08822a0ce...@s9g2000prm.googlegroups.com>...
> > On Nov 18, 12:01 pm, "Travis" <sinuso...@hotmail.com> wrote:
> > > I have a file with data at lat/longs, and a file with River miles at lat/longs. How can I interpolate the River mile onto the data. I have tried using interp2, but that has been hugely unsuccessful. Please keep in mind that the river meanders and frequently doubles back on itself in both latitude and longitude.
>
> > Lets say you have s(x,y) river miles, where x and y are the long and
> > lat respectively, and you want to find s for a particular xp, yp.
> > You need to split your problem into two parts:
> > 1. Find the segment in x,y where xp,yp lies by firstly finding the
> > segments where the normal from xp,yp is inside the segment and
> > secondly by minimising the distance of the normal to each of those
> > segments.
> > 2. Interpolate on s within the optimal segment.
>
> I have tried seperating the lat and long and using interp 1, but since it double back on itself, the values are not distinct, and it doesn't work.

It doesn't seem like you have followed my advice.
Show us the code you used for my Step 1 (which is the more important
part).

Subject: River miles

From: Wolfgang Schwanghart

Date: 18 Nov, 2008 09:20:19

Message: 5 of 26

I think you need to better specify what your data looks like. I assume you have a 3xn array with x and y coordinates and river length and a 2xn array with vertex coordinates of the river course. Am I right to assume so?




"Travis" <sinusoid2@hotmail.com> wrote in message <gftkl5$6b$1@fred.mathworks.com>...
> NZTideMan <mulgor@gmail.com> wrote in message <4521b8d9-2021-4ff0-b430-08822a0ce2bc@s9g2000prm.googlegroups.com>...
> > On Nov 18, 12:01 pm, "Travis" <sinuso...@hotmail.com> wrote:
> > > I have a file with data at lat/longs, and a file with River miles at lat/longs. How can I interpolate the River mile onto the data. I have tried using interp2, but that has been hugely unsuccessful. Please keep in mind that the river meanders and frequently doubles back on itself in both latitude and longitude.
> >
> > Lets say you have s(x,y) river miles, where x and y are the long and
> > lat respectively, and you want to find s for a particular xp, yp.
> > You need to split your problem into two parts:
> > 1. Find the segment in x,y where xp,yp lies by firstly finding the
> > segments where the normal from xp,yp is inside the segment and
> > secondly by minimising the distance of the normal to each of those
> > segments.
> > 2. Interpolate on s within the optimal segment.
>
>
> I have tried seperating the lat and long and using interp 1, but since it double back on itself, the values are not distinct, and it doesn't work.

Subject: River miles

From: Rune Allnor

Date: 18 Nov, 2008 09:26:04

Message: 6 of 26

On 18 Nov, 00:01, "Travis" <sinuso...@hotmail.com> wrote:
> I have a file with data at lat/longs, and a file with River miles at lat/=
longs. =A0How can I interpolate the River mile onto the data. =A0

What do you try to do? Do you have the lat-longs and
distances for the same points? If so it ought to be
trivial to interpolate the data.

Rune

Subject: River miles

From: John D'Errico

Date: 18 Nov, 2008 13:30:20

Message: 7 of 26

Rune Allnor <allnor@tele.ntnu.no> wrote in message <90f017a9-906d-4c7d-8ac5-7167e15e0d8c@u18g2000pro.googlegroups.com>...
> On 18 Nov, 00:01, "Travis" <sinuso...@hotmail.com> wrote:
> > I have a file with data at lat/longs, and a file with River miles at lat/=
> longs. =A0How can I interpolate the River mile onto the data. =A0
>
> What do you try to do? Do you have the lat-longs and
> distances for the same points? If so it ought to be
> trivial to interpolate the data.
>
> Rune

Consider this simple example. I have a "river" that passes
through the three points:

xy = [0 0;0 1; 1 1]

At each point, I have some other parameter or parameters
associated, some values of z at those points. Now, I have
another point, perhaps at the (x,y) coordinates (0.20, 0.75).
How should I choose to interpolate the z value onto that
new point?

I'll assume that the "river" meanders around so that it passes
through this new point, but the interpolation process is surely
not trivial in general. You must decide how the river has
meandered between the existing points, and even decide
which pair of points this new point lies between.

Yes, it is surely doable, and nztideman has suggested a
method that has serious merit. But it is not trivial.

John

Subject: River miles

From: Rune Allnor

Date: 18 Nov, 2008 14:09:18

Message: 8 of 26

On 18 Nov, 14:30, "John D'Errico" <woodch...@rochester.rr.com> wrote:
> Rune Allnor <all...@tele.ntnu.no> wrote in message <90f017a9-906d-4c7d-8ac5-7167e15e0...@u18g2000pro.googlegroups.com>...
> > On 18 Nov, 00:01, "Travis" <sinuso...@hotmail.com> wrote:
> > > I have a file with data at lat/longs, and a file with River miles at lat/=
> > longs. =A0How can I interpolate the River mile onto the data. =A0
>
> > What do you try to do? Do you have the lat-longs and
> > distances for the same points? If so it ought to be
> > trivial to interpolate the data.
>
> > Rune
>
> Consider this simple example. I have a "river" that passes
> through the three points:
>
> xy = [0 0;0 1; 1 1]
>
> At each point, I have some other parameter or parameters
> associated, some values of z at those points. Now, I have
> another point, perhaps at the (x,y) coordinates (0.20, 0.75).
> How should I choose to interpolate the z value onto that
> new point?

First, assign a distance d for each of the points (view
table with fixed-width fonts):

       lat long d
xy = [ 0 0 0;
       0 1 1;
       1 1 2;]

Use some measure to project the position onto the line
(shortest distance, lat-priority, long-priority) and
obtain a distance estimate for the observed point.
Go on from there.

> I'll assume that the "river" meanders around so that it passes
> through this new point, but the interpolation process is surely
> not trivial in general.

If you didn't track the river in sufficient detail you
are basically in over your head anyway.

> You must decide how the river has
> meandered between the existing points, and even decide
> which pair of points this new point lies between.

Nope. That's guesswork, as the measurements are too sparse
to be useful. Use at your own risk. If you really want
to track a meandering river, you need to sample its
positions far denser than the loops in the river.

> Yes, it is surely doable, and nztideman has suggested a
> method that has serious merit. But it is not trivial.

It's basically the same method I suggested. Don't expect
all points to map into the interior of any line segment,
though. For instance, with the track you suggested,
where do you map the point (0.9, 1.1)? And don't expect
the answets to be unique; where do you assign (1.1,0.9)?

The answers depend on what projection rule you select.

Rune

Subject: River miles

From: Travis

Date: 18 Nov, 2008 15:13:01

Message: 9 of 26

Rune Allnor <allnor@tele.ntnu.no> wrote in message <6875d2af-8eb2-443a-a831-d4c1773c1180@c36g2000prc.googlegroups.com>...
> On 18 Nov, 14:30, "John D'Errico" <woodch...@rochester.rr.com> wrote:
> > Rune Allnor <all...@tele.ntnu.no> wrote in message <90f017a9-906d-4c7d-8ac5-7167e15e0...@u18g2000pro.googlegroups.com>...
> > > On 18 Nov, 00:01, "Travis" <sinuso...@hotmail.com> wrote:
> > > > I have a file with data at lat/longs, and a file with River miles at lat/=
> > > longs. =A0How can I interpolate the River mile onto the data. =A0
> >
> > > What do you try to do? Do you have the lat-longs and
> > > distances for the same points? If so it ought to be
> > > trivial to interpolate the data.
> >
> > > Rune
> >
> > Consider this simple example. I have a "river" that passes
> > through the three points:
> >
> > xy = [0 0;0 1; 1 1]
> >
> > At each point, I have some other parameter or parameters
> > associated, some values of z at those points. Now, I have
> > another point, perhaps at the (x,y) coordinates (0.20, 0.75).
> > How should I choose to interpolate the z value onto that
> > new point?
>
> First, assign a distance d for each of the points (view
> table with fixed-width fonts):
>
> lat long d
> xy = [ 0 0 0;
> 0 1 1;
> 1 1 2;]
>
> Use some measure to project the position onto the line
> (shortest distance, lat-priority, long-priority) and
> obtain a distance estimate for the observed point.
> Go on from there.
>
> > I'll assume that the "river" meanders around so that it passes
> > through this new point, but the interpolation process is surely
> > not trivial in general.
>
> If you didn't track the river in sufficient detail you
> are basically in over your head anyway.
>
> > You must decide how the river has
> > meandered between the existing points, and even decide
> > which pair of points this new point lies between.
>
> Nope. That's guesswork, as the measurements are too sparse
> to be useful. Use at your own risk. If you really want
> to track a meandering river, you need to sample its
> positions far denser than the loops in the river.
>
> > Yes, it is surely doable, and nztideman has suggested a
> > method that has serious merit. But it is not trivial.
>
> It's basically the same method I suggested. Don't expect
> all points to map into the interior of any line segment,
> though. For instance, with the track you suggested,
> where do you map the point (0.9, 1.1)? And don't expect
> the answets to be unique; where do you assign (1.1,0.9)?
>
> The answers depend on what projection rule you select.
>
> Rune

Wolfgang, that is a correct assumption. Rune the river was mapped using a GPS that recorded time, posiion, and heading each time the heading changed. It was then interpolated so that data taken between heading chages have unique lat/long values. Are you suggesting that I break the river up into segments that do not double back on themselves and use interp1 on each segment? I have a 60 mile stretch of river to do this for.

Subject: River miles

From: Rune Allnor

Date: 18 Nov, 2008 15:27:25

Message: 10 of 26

On 18 Nov, 16:13, "Travis" <sinuso...@hotmail.com> wrote:
> Rune Allnor <all...@tele.ntnu.no> wrote in message <6875d2af-8eb2-443a-a8=
31-d4c1773c1...@c36g2000prc.googlegroups.com>...

> =A0Rune the river was mapped using a GPS that recorded time, posiion, and=
 heading each time the heading changed. =A0It was then interpolated so that=
 data taken between heading chages have unique lat/long values. =A0Are you =
suggesting that I break the river up into segments that do not double back =
on themselves

Yes. Use the segments between consecutive (lat,long) points
as basis.

> and use interp1 on each segment?

No. Interpolate the whole curve.

>=A0I have a 60 mile stretch of river to do this for. =A0

No need to do that manually. The idea is to sort
the data not according to lat or long, but according
to travelled/accumulated distance.

The distance serves as a parameter, and so the
(lat, long) path becomes an arbitrary parametric
curve in the plane. Once you see this basic idea
the rest is (almost) trivial.

Rune

Subject: River miles

From: Travis

Date: 19 Nov, 2008 20:42:01

Message: 11 of 26

Rune Allnor <allnor@tele.ntnu.no> wrote in message <f36d9204-1e90-4b53-b6f2-6d1b6ecb1f4b@i18g2000prf.googlegroups.com>...
> On 18 Nov, 16:13, "Travis" <sinuso...@hotmail.com> wrote:
> > Rune Allnor <all...@tele.ntnu.no> wrote in message <6875d2af-8eb2-443a-a8=
> 31-d4c1773c1...@c36g2000prc.googlegroups.com>...
>
> > =A0Rune the river was mapped using a GPS that recorded time, posiion, and=
> heading each time the heading changed. =A0It was then interpolated so that=
> data taken between heading chages have unique lat/long values. =A0Are you =
> suggesting that I break the river up into segments that do not double back =
> on themselves
>
> Yes. Use the segments between consecutive (lat,long) points
> as basis.
>
> > and use interp1 on each segment?
>
> No. Interpolate the whole curve.
>
> >=A0I have a 60 mile stretch of river to do this for. =A0
>
> No need to do that manually. The idea is to sort
> the data not according to lat or long, but according
> to travelled/accumulated distance.
>
> The distance serves as a parameter, and so the
> (lat, long) path becomes an arbitrary parametric
> curve in the plane. Once you see this basic idea
> the rest is (almost) trivial.
>
> Rune



What coding would I use in this instance?

Subject: River miles

From: Rune Allnor

Date: 19 Nov, 2008 21:40:59

Message: 12 of 26

On 19 Nov, 21:42, "Travis" <sinuso...@hotmail.com> wrote:
> Rune Allnor <all...@tele.ntnu.no> wrote in message <f36d9204-1e90-4b53-b6=
f2-6d1b6ecb1...@i18g2000prf.googlegroups.com>...
> > On 18 Nov, 16:13, "Travis" <sinuso...@hotmail.com> wrote:
> > > Rune Allnor <all...@tele.ntnu.no> wrote in message <6875d2af-8eb2-443=
a-a8=3D
> > 31-d4c1773c1...@c36g2000prc.googlegroups.com>...
>
> > > =3DA0Rune the river was mapped using a GPS that recorded time, posiio=
n, and=3D
> > =A0heading each time the heading changed. =3DA0It was then interpolated=
 so that=3D
> > =A0data taken between heading chages have unique lat/long values. =3DA0=
Are you =3D
> > suggesting that I break the river up into segments that do not double b=
ack =3D
> > on themselves
>
> > Yes. Use the segments between consecutive (lat,long) points
> > as basis.
>
> > > and use interp1 on each segment?
>
> > No. Interpolate the whole curve.
>
> > >=3DA0I have a 60 mile stretch of river to do this for. =3DA0
>
> > No need to do that manually. The idea is to sort
> > the data not according to lat or long, but according
> > to travelled/accumulated distance.
>
> > The distance serves as a parameter, and so the
> > (lat, long) path becomes an arbitrary parametric
> > curve in the plane. Once you see this basic idea
> > the rest is (almost) trivial.
>
> > Rune
>
> What coding would I use in this instance?=96 Skjul sitert tekst =96
>
> =96 Vis sitert tekst =96

Don't know what you mean by coding, but here's an example:

% lat long dist
d =3D[0.0081 0.9128 0
    0.1340 0.9210 0.9307
    0.2437 0.9485 1.9100
    0.3660 0.9609 2.9382
    0.5027 0.9581 4.0202
    0.5836 0.9375 5.1245
    0.6106 0.9114 6.2216
    0.6178 0.8592 7.2798
    0.5567 0.7837 8.2410
    0.4344 0.7658 9.1215
    0.2671 0.7782 9.9442
    0.1736 0.7919 10.7549
    0.0872 0.7617 11.5215
    0.0854 0.6985 12.2252
    0.1178 0.6738 12.9092
    0.3300 0.6078 13.6008
    0.4308 0.6147 14.3514
    0.6106 0.6490 15.2426
    0.7383 0.6834 16.2486
    0.8714 0.7012 17.3671
    0.9379 0.6463 18.5062
    0.9397 0.5968 19.6194
    0.9074 0.5391 20.6749
    0.8444 0.5364 21.6753
    0.7167 0.5474 22.5771
    0.5800 0.5776 23.3957
    0.4829 0.5254 24.1093
    0.3804 0.4512 24.6995
    0.3768 0.4045 25.2524
    0.4272 0.3674 25.8158
    0.5495 0.3633 26.4745
    0.6214 0.3743 27.2000
    0.7581 0.3565 28.0377
    0.7923 0.3207 28.8924
    0.7815 0.2507 29.7131
    0.7131 0.1655 30.4452
    0.5585 0.1669 31.0281
    0.4937 0.1875 31.5562
    0.3678 0.2026 31.9761
    0.2653 0.1806 32.2970
    0.2149 0.1133 32.5400
    0.2941 0.0680 32.8418
    0.4200 0.0694 33.2675
    0.5387 0.0556 33.8090];

% Plot the river path
subplot(2,1,1)
plot(d(:,1),d(:,2))

% Plot the lat and long vs distance
subplot(2,1,2)
plot(d(:,3),d(:,1),'b',d(:,3),d(:,2),'r')

Now you can interpolate both lats and longs with
respect to distance, and maybe be able to go on
from there.

Rune

Subject: River miles

From: Travis

Date: 19 Nov, 2008 22:11:02

Message: 13 of 26

Rune Allnor <allnor@tele.ntnu.no> wrote in message <01d3cdd8-c83e-47bc-9357-fb97949f0eff@r40g2000yqj.googlegroups.com>...
> On 19 Nov, 21:42, "Travis" <sinuso...@hotmail.com> wrote:
> > Rune Allnor <all...@tele.ntnu.no> wrote in message <f36d9204-1e90-4b53-b6=
> f2-6d1b6ecb1...@i18g2000prf.googlegroups.com>...
> > > On 18 Nov, 16:13, "Travis" <sinuso...@hotmail.com> wrote:
> > > > Rune Allnor <all...@tele.ntnu.no> wrote in message <6875d2af-8eb2-443=
> a-a8=3D
> > > 31-d4c1773c1...@c36g2000prc.googlegroups.com>...
> >
> > > > =3DA0Rune the river was mapped using a GPS that recorded time, posiio=
> n, and=3D
> > > =A0heading each time the heading changed. =3DA0It was then interpolated=
> so that=3D
> > > =A0data taken between heading chages have unique lat/long values. =3DA0=
> Are you =3D
> > > suggesting that I break the river up into segments that do not double b=
> ack =3D
> > > on themselves
> >
> > > Yes. Use the segments between consecutive (lat,long) points
> > > as basis.
> >
> > > > and use interp1 on each segment?
> >
> > > No. Interpolate the whole curve.
> >
> > > >=3DA0I have a 60 mile stretch of river to do this for. =3DA0
> >
> > > No need to do that manually. The idea is to sort
> > > the data not according to lat or long, but according
> > > to travelled/accumulated distance.
> >
> > > The distance serves as a parameter, and so the
> > > (lat, long) path becomes an arbitrary parametric
> > > curve in the plane. Once you see this basic idea
> > > the rest is (almost) trivial.
> >
> > > Rune
> >
> > What coding would I use in this instance?=96 Skjul sitert tekst =96
> >
> > =96 Vis sitert tekst =96
>
> Don't know what you mean by coding, but here's an example:
>
> % lat long dist
> d =3D[0.0081 0.9128 0
> 0.1340 0.9210 0.9307
> 0.2437 0.9485 1.9100
> 0.3660 0.9609 2.9382
> 0.5027 0.9581 4.0202
> 0.5836 0.9375 5.1245
> 0.6106 0.9114 6.2216
> 0.6178 0.8592 7.2798
> 0.5567 0.7837 8.2410
> 0.4344 0.7658 9.1215
> 0.2671 0.7782 9.9442
> 0.1736 0.7919 10.7549
> 0.0872 0.7617 11.5215
> 0.0854 0.6985 12.2252
> 0.1178 0.6738 12.9092
> 0.3300 0.6078 13.6008
> 0.4308 0.6147 14.3514
> 0.6106 0.6490 15.2426
> 0.7383 0.6834 16.2486
> 0.8714 0.7012 17.3671
> 0.9379 0.6463 18.5062
> 0.9397 0.5968 19.6194
> 0.9074 0.5391 20.6749
> 0.8444 0.5364 21.6753
> 0.7167 0.5474 22.5771
> 0.5800 0.5776 23.3957
> 0.4829 0.5254 24.1093
> 0.3804 0.4512 24.6995
> 0.3768 0.4045 25.2524
> 0.4272 0.3674 25.8158
> 0.5495 0.3633 26.4745
> 0.6214 0.3743 27.2000
> 0.7581 0.3565 28.0377
> 0.7923 0.3207 28.8924
> 0.7815 0.2507 29.7131
> 0.7131 0.1655 30.4452
> 0.5585 0.1669 31.0281
> 0.4937 0.1875 31.5562
> 0.3678 0.2026 31.9761
> 0.2653 0.1806 32.2970
> 0.2149 0.1133 32.5400
> 0.2941 0.0680 32.8418
> 0.4200 0.0694 33.2675
> 0.5387 0.0556 33.8090];
>
> % Plot the river path
> subplot(2,1,1)
> plot(d(:,1),d(:,2))
>
> % Plot the lat and long vs distance
> subplot(2,1,2)
> plot(d(:,3),d(:,1),'b',d(:,3),d(:,2),'r')
>
> Now you can interpolate both lats and longs with
> respect to distance, and maybe be able to go on
> from there.
>
> Rune

You are forgetting that even interpolating to either lat or long has a problem...there are mulitple river miles for numerous lats/longs, and matlab does not like that.

Subject: River miles

From: Loren Shure

Date: 19 Nov, 2008 22:22:07

Message: 14 of 26

In article <gg22tm$k2v$1@fred.mathworks.com>, sinusoid2@hotmail.com
says...
> Rune Allnor <allnor@tele.ntnu.no> wrote in message <01d3cdd8-c83e-47bc-9357-fb97949f0eff@r40g2000yqj.googlegroups.com>...
> > On 19 Nov, 21:42, "Travis" <sinuso...@hotmail.com> wrote:
> > > Rune Allnor <all...@tele.ntnu.no> wrote in message <f36d9204-1e90-4b53-b6=
> > f2-6d1b6ecb1...@i18g2000prf.googlegroups.com>...
> > > > On 18 Nov, 16:13, "Travis" <sinuso...@hotmail.com> wrote:
> > > > > Rune Allnor <all...@tele.ntnu.no> wrote in message <6875d2af-8eb2-443=
> > a-a8=3D
> > > > 31-d4c1773c1...@c36g2000prc.googlegroups.com>...
> > >
> > > > > =3DA0Rune the river was mapped using a GPS that recorded time, posiio=
> > n, and=3D
> > > > =A0heading each time the heading changed. =3DA0It was then interpolated=
> > so that=3D
> > > > =A0data taken between heading chages have unique lat/long values. =3DA0=
> > Are you =3D
> > > > suggesting that I break the river up into segments that do not double b=
> > ack =3D
> > > > on themselves
> > >
> > > > Yes. Use the segments between consecutive (lat,long) points
> > > > as basis.
> > >
> > > > > and use interp1 on each segment?
> > >
> > > > No. Interpolate the whole curve.
> > >
> > > > >=3DA0I have a 60 mile stretch of river to do this for. =3DA0
> > >
> > > > No need to do that manually. The idea is to sort
> > > > the data not according to lat or long, but according
> > > > to travelled/accumulated distance.
> > >
> > > > The distance serves as a parameter, and so the
> > > > (lat, long) path becomes an arbitrary parametric
> > > > curve in the plane. Once you see this basic idea
> > > > the rest is (almost) trivial.
> > >
> > > > Rune
> > >
> > > What coding would I use in this instance?=96 Skjul sitert tekst =96
> > >
> > > =96 Vis sitert tekst =96
> >
> > Don't know what you mean by coding, but here's an example:
> >
> > % lat long dist
> > d =3D[0.0081 0.9128 0
> > 0.1340 0.9210 0.9307
> > 0.2437 0.9485 1.9100
> > 0.3660 0.9609 2.9382
> > 0.5027 0.9581 4.0202
> > 0.5836 0.9375 5.1245
> > 0.6106 0.9114 6.2216
> > 0.6178 0.8592 7.2798
> > 0.5567 0.7837 8.2410
> > 0.4344 0.7658 9.1215
> > 0.2671 0.7782 9.9442
> > 0.1736 0.7919 10.7549
> > 0.0872 0.7617 11.5215
> > 0.0854 0.6985 12.2252
> > 0.1178 0.6738 12.9092
> > 0.3300 0.6078 13.6008
> > 0.4308 0.6147 14.3514
> > 0.6106 0.6490 15.2426
> > 0.7383 0.6834 16.2486
> > 0.8714 0.7012 17.3671
> > 0.9379 0.6463 18.5062
> > 0.9397 0.5968 19.6194
> > 0.9074 0.5391 20.6749
> > 0.8444 0.5364 21.6753
> > 0.7167 0.5474 22.5771
> > 0.5800 0.5776 23.3957
> > 0.4829 0.5254 24.1093
> > 0.3804 0.4512 24.6995
> > 0.3768 0.4045 25.2524
> > 0.4272 0.3674 25.8158
> > 0.5495 0.3633 26.4745
> > 0.6214 0.3743 27.2000
> > 0.7581 0.3565 28.0377
> > 0.7923 0.3207 28.8924
> > 0.7815 0.2507 29.7131
> > 0.7131 0.1655 30.4452
> > 0.5585 0.1669 31.0281
> > 0.4937 0.1875 31.5562
> > 0.3678 0.2026 31.9761
> > 0.2653 0.1806 32.2970
> > 0.2149 0.1133 32.5400
> > 0.2941 0.0680 32.8418
> > 0.4200 0.0694 33.2675
> > 0.5387 0.0556 33.8090];
> >
> > % Plot the river path
> > subplot(2,1,1)
> > plot(d(:,1),d(:,2))
> >
> > % Plot the lat and long vs distance
> > subplot(2,1,2)
> > plot(d(:,3),d(:,1),'b',d(:,3),d(:,2),'r')
> >
> > Now you can interpolate both lats and longs with
> > respect to distance, and maybe be able to go on
> > from there.
> >
> > Rune
>
> You are forgetting that even interpolating to either lat or long has a problem...there are mulitple river miles for numerous lats/longs, and matlab does not like that.
>

What Rune meant, and should work, is to separately interpolate lat vs.
dist and long vs. dist, with dist the independent variable. Then you
should have new matching arrays for lat and long.

--
Loren
http://blogs.mathworks.com/loren

Subject: River miles

From: Travis

Date: 19 Nov, 2008 22:40:18

Message: 15 of 26

> What Rune meant, and should work, is to separately interpolate lat vs.
> dist and long vs. dist, with dist the independent variable. Then you
> should have new matching arrays for lat and long.
>
> --
> Loren
> http://blogs.mathworks.com/loren

How can I interpolate Lat vs. Dist and Long vs. Dist when a certain Lat or certain Long may have multiple Dist numbers associated with it? I have tried using interp1 just using lat or long and dist, and it doesn't work.

Subject: River miles

From: NZTideMan

Date: 20 Nov, 2008 04:24:52

Message: 16 of 26

The very simplest way would be to simply find the nearest node to your
point:
[dmn,imn]=min(abs(x+i*y - (xp+i*yp)));
Then s(imn) is the river mile of the nearest node.

Subject: River miles

From: Bjorn Gustavsson

Date: 20 Nov, 2008 08:37:04

Message: 17 of 26

"Travis" <sinusoid2@hotmail.com> wrote in message <gg24kh$c5h$1@fred.mathworks.com>...
> > What Rune meant, and should work, is to separately interpolate lat vs.
> > dist and long vs. dist, with dist the independent variable. Then you
> > should have new matching arrays for lat and long.
> >
> > --
> > Loren
> > http://blogs.mathworks.com/loren
>
> How can I interpolate Lat vs. Dist and Long vs. Dist when a certain Lat or certain Long
> may have multiple Dist numbers associated with it? I have tried using interp1 just using lat
> or long and dist, and it doesn't work.
Something like this:

Lat_i = interp1(dist,lat,dist_i);

HTH,
Bjoern

Subject: River miles

From: NZTideMan

Date: 20 Nov, 2008 08:57:53

Message: 18 of 26

On Nov 20, 9:37 pm, "Bjorn Gustavsson" <bj...@irf.se> wrote:
> "Travis" <sinuso...@hotmail.com> wrote in message <gg24kh$c5...@fred.mathworks.com>...
> > > What Rune meant, and should work, is to separately interpolate lat vs.
> > > dist and long vs. dist, with dist the independent variable. Then you
> > > should have new matching arrays for lat and long.
>
> > > --
> > > Loren
> > >http://blogs.mathworks.com/loren
>
> > How can I interpolate Lat vs. Dist and Long vs. Dist when a certain Lat or certain Long
> > may have multiple Dist numbers associated with it? I have tried using interp1 just using lat
> > or long and dist, and it doesn't work.
>
> Something like this:
>
> Lat_i = interp1(dist,lat,dist_i);
>
> HTH,
> Bjoern

But that's arse about face.
They want the distance for a given lat, long

Subject: River miles

From: Rune Allnor

Date: 20 Nov, 2008 09:14:25

Message: 19 of 26

On 20 Nov, 09:57, NZTideMan <mul...@gmail.com> wrote:
> On Nov 20, 9:37 pm, "Bjorn Gustavsson" <bj...@irf.se> wrote:
>
>
>
>
>
> > "Travis" <sinuso...@hotmail.com> wrote in message <gg24kh$c5...@fred.ma=
thworks.com>...
> > > > What Rune meant, and should work, is to separately interpolate lat =
vs.
> > > > dist and long vs. dist, with dist the independent variable. =A0Then=
 you
> > > > should have new matching arrays for lat and long.
>
> > > > --
> > > > Loren
> > > >http://blogs.mathworks.com/loren
>
> > > How can I interpolate Lat vs. Dist and Long vs. Dist when a certain L=
at or certain Long
> > > may have multiple Dist numbers associated with it? =A0I have tried us=
ing interp1 just using lat
> > > or long and dist, and it doesn't work.
>
> > Something like this:
>
> > Lat_i =3D interp1(dist,lat,dist_i);
>
> > HTH,
> > Bjoern
>
> But that's arse about face.
> They want the distance for a given lat, long

If they've sampled the positions with too poor resolution,
which it seems they have, they can't have it. The best they
can do is to get some "reasonable" distance estimate that
visits the same (dx,dy) cells and then hope that they can
deduce what leg of the river it is, by other means.

Rune

Subject: River miles

From: Loren Shure

Date: 20 Nov, 2008 12:30:03

Message: 20 of 26

In article <gg24kh$c5h$1@fred.mathworks.com>, sinusoid2@hotmail.com
says...
> > What Rune meant, and should work, is to separately interpolate lat vs.
> > dist and long vs. dist, with dist the independent variable. Then you
> > should have new matching arrays for lat and long.
> >
> > --
> > Loren
> > http://blogs.mathworks.com/loren
>
> How can I interpolate Lat vs. Dist and Long vs. Dist when a certain Lat or certain Long may have multiple Dist numbers associated with it? I have tried using interp1 just using lat or long and dist, and it doesn't work.
>

Interpolate the other way around:

dist vs. lat
dist vs. long

then use the new lat, long as pairs

--
Loren
http://blogs.mathworks.com/loren

Subject: River miles

From: Travis

Date: 20 Nov, 2008 15:39:02

Message: 21 of 26

Loren Shure <loren@mathworks.com> wrote in message <MPG.238f225981c556229898f6@news.mathworks.com>...
> In article <gg24kh$c5h$1@fred.mathworks.com>, sinusoid2@hotmail.com
> says...
> > > What Rune meant, and should work, is to separately interpolate lat vs.
> > > dist and long vs. dist, with dist the independent variable. Then you
> > > should have new matching arrays for lat and long.
> > >
> > > --
> > > Loren
> > > http://blogs.mathworks.com/loren
> >
> > How can I interpolate Lat vs. Dist and Long vs. Dist when a certain Lat or certain Long may have multiple Dist numbers associated with it? I have tried using interp1 just using lat or long and dist, and it doesn't work.
> >
>
> Interpolate the other way around:
>
> dist vs. lat
> dist vs. long
>
> then use the new lat, long as pairs
>
> --
> Loren
> http://blogs.mathworks.com/loren

The samples are at a fine enough interval to where a river mile can be obtained. Again with the dist vs. lat/long. A single lat or single long may have multiple distances associated with it due to the meanders of the river.

Subject: River miles

From: Rune Allnor

Date: 20 Nov, 2008 16:03:12

Message: 22 of 26

On 20 Nov, 16:39, "Travis" <sinuso...@hotmail.com> wrote:

> The samples are at a fine enough interval to where a river mile can be ob=
tained. =A0Again with the dist vs. lat/long. =A0A single lat or single long=
 may have multiple distances associated with it due to the meanders of the =
river. =A0

So what? Go back to the example I posted, read it,
run it and then contemplate it. Everything you need
is there.

Rune

Subject: River miles

From: Travis

Date: 21 Nov, 2008 05:09:02

Message: 23 of 26

Rune Allnor <allnor@tele.ntnu.no> wrote in message <8f6d2252-4e3f-4a08-88b0-4cfd778c37bd@j38g2000yqa.googlegroups.com>...
> On 20 Nov, 16:39, "Travis" <sinuso...@hotmail.com> wrote:
>
> > The samples are at a fine enough interval to where a river mile can be ob=
> tained. =A0Again with the dist vs. lat/long. =A0A single lat or single long=
> may have multiple distances associated with it due to the meanders of the =
> river. =A0
>
> So what? Go back to the example I posted, read it,
> run it and then contemplate it. Everything you need
> is there.
>
> Rune

Please type the code you would use. From how I am reading it it won't work, but I might be reading it incorrectly.

Subject: River miles

From: Travis

Date: 2 Dec, 2008 03:27:01

Message: 24 of 26

37.3097 -120.9301
37.3097 -120.9301
37.3097 -120.9301
37.3097 -120.9301
37.3097 -120.9302
37.3097 -120.9302
37.3098 -120.9302
37.3098 -120.9302
37.3098 -120.9302
37.3098 -120.9302
37.3098 -120.9302
37.3098 -120.9302
37.3098 -120.9302
37.3098 -120.9303
37.3098 -120.9303
37.3098 -120.9303
37.3098 -120.9303
37.3098 -120.9303
37.3101 -120.9307
37.3102 -120.9309
37.3103 -120.9311
37.3106 -120.9314
37.3109 -120.9315
37.311 -120.9314
37.3113 -120.9313
37.3118 -120.9314
37.3118 -120.9317
37.3119 -120.9317
37.3121 -120.9319
37.3121 -120.9326
37.3121 -120.9333
37.312 -120.9341
37.3119 -120.9347
37.3119 -120.935
37.3118 -120.9354
37.3117 -120.9358
37.3116 -120.936
37.3115 -120.9362
37.3115 -120.9363
37.3114 -120.9365
37.3114 -120.9366
37.3113 -120.9367
37.3113 -120.9368
37.3113 -120.9369
37.3113 -120.9369
37.3113 -120.937
37.3112 -120.9371
37.311 -120.9375
37.3108 -120.9377
37.3107 -120.938
37.3105 -120.9384
37.3105 -120.9386
37.3108 -120.9393
37.3114 -120.94
37.312 -120.94
37.3125 -120.9399
37.3126 -120.9398
37.3126 -120.9398
37.3127 -120.9397
37.3127 -120.9397
37.3128 -120.9397
37.3128 -120.9397
37.3128 -120.9397
37.3195 -120.9355
37.3195 -120.9355
37.3196 -120.9355
37.3196 -120.9355
37.3196 -120.9355
37.3196 -120.9355
37.3196 -120.9355
37.3196 -120.9355
37.3196 -120.9355
37.3196 -120.9355
37.3196 -120.9355
37.3196 -120.9355
37.3197 -120.9355
37.3197 -120.9355
37.3197 -120.9355
37.3197 -120.9355
37.3197 -120.9355
37.3197 -120.9355
37.3197 -120.9355
37.3198 -120.9355
37.3199 -120.9356
37.3202 -120.9357
37.3206 -120.9358
37.3209 -120.9357
37.3212 -120.9356
37.3214 -120.9353
37.3219 -120.9351
37.3224 -120.9354
37.3229 -120.9359
37.3231 -120.9362
37.3234 -120.9365
37.3235 -120.9368
37.3237 -120.937
37.3239 -120.9375
37.3239 -120.9377
37.3314 -120.9438
37.3308 -120.9436
37.3314 -120.9431
37.3316 -120.943
37.3318 -120.9429
37.332 -120.9429
37.3323 -120.9429
37.3326 -120.9432
37.3327 -120.9434
37.3327 -120.9436
37.3326 -120.9438
37.3325 -120.9438
37.3323 -120.9441
37.3321 -120.9444
37.3319 -120.9444
37.3318 -120.9446
37.3317 -120.945
37.3316 -120.9453
37.3317 -120.9454
37.3318 -120.9456
37.3318 -120.9459
37.3318 -120.9461
37.3318 -120.9463
37.3318 -120.9464
37.3318 -120.9465
37.3318 -120.9465
37.3318 -120.9465
37.3318 -120.9465
37.3317 -120.9466
37.3316 -120.9467
37.3316 -120.9468
37.3315 -120.9468
37.3313 -120.9471
37.3312 -120.9474
37.3312 -120.9476
37.3313 -120.948
37.3316 -120.9481
37.3317 -120.9481
37.3318 -120.9482
37.3319 -120.9484
37.332 -120.9486
37.332 -120.9488
37.332 -120.949
37.3319 -120.9492
37.3318 -120.9496
37.3317 -120.9499
37.3316 -120.9501
37.3316 -120.9507
37.3316 -120.9509
37.3316 -120.9509
37.3316 -120.9509
37.3316 -120.9509
37.3316 -120.951
37.3316 -120.951
37.3316 -120.951
37.3316 -120.951
37.3316 -120.9511
37.3316 -120.9511
37.3316 -120.9511
37.3316 -120.9511
37.3316 -120.9513
37.3315 -120.9517
37.3313 -120.9521
37.3313 -120.9524
37.3313 -120.9524
37.3313 -120.9525
37.3313 -120.9525
37.3313 -120.9526
37.3314 -120.9526
37.3314 -120.9526
37.3314 -120.9527
37.3317 -120.9531
37.3325 -120.953
37.3332 -120.9524
37.3333 -120.9524
37.3337 -120.9522
37.3347 -120.9524
37.3353 -120.9529
37.3354 -120.9535
37.3353 -120.9544
37.3352 -120.9548
37.3351 -120.955
37.3351 -120.955
37.335 -120.955
37.3349 -120.9554
37.335 -120.9563
37.3354 -120.9569
37.3356 -120.9571
37.3359 -120.9573
37.3362 -120.9577
37.3366 -120.9581
37.3368 -120.9584
37.3369 -120.9584
37.3372 -120.9585
37.3368 -120.9593
37.3366 -120.9596
37.3361 -120.96
37.3355 -120.96
37.3354 -120.96
37.3353 -120.96
37.3352 -120.9601
37.3352 -120.9601
37.3351 -120.9601
37.3351 -120.9601
37.3351 -120.9601
37.3351 -120.9602
37.3351 -120.9602
37.335 -120.9602
37.335 -120.9602
37.335 -120.9603
37.3347 -120.9604
37.3341 -120.9607
37.3339 -120.9614
37.3343 -120.9616
37.3345 -120.962
37.3349 -120.9628
37.3352 -120.9639
37.3355 -120.9647
37.3358 -120.9652
37.3361 -120.9655
37.337 -120.966
37.3369 -120.967
37.3364 -120.9677
37.3361 -120.9684
37.3363 -120.9693
37.3366 -120.9696
37.3368 -120.9696
37.3369 -120.9697
37.3369 -120.9698
37.3372 -120.97
37.3378 -120.9703
37.3383 -120.9706
37.3388 -120.9711
37.3389 -120.9717
37.3386 -120.9721
37.3382 -120.9726
37.3378 -120.9726
37.3378 -120.9726
37.3378 -120.9727
37.3379 -120.9727
37.3379 -120.9727
37.3379 -120.9728
37.338 -120.9728
37.3393 -120.9731
37.3406 -120.9733
37.341 -120.9751
37.3405 -120.9759
37.3402 -120.976
37.3401 -120.9762
37.3401 -120.9763
37.34 -120.9765
37.3401 -120.9766
37.3402 -120.9766
37.3403 -120.9768
37.3404 -120.9768
37.3404 -120.9768
37.3404 -120.9767
37.3406 -120.9768
37.3407 -120.9768
37.3412 -120.9773
37.3413 -120.9783
37.342 -120.9787
37.3423 -120.9783
37.3424 -120.9779
37.3428 -120.9772
37.3432 -120.9767
37.3434 -120.9765
37.3435 -120.9765
37.344 -120.9762
37.3449 -120.9757
37.3455 -120.9757
37.3461 -120.9759
37.3464 -120.9765
37.3468 -120.9766
37.3471 -120.9759
37.3473 -120.9753
37.3474 -120.9753
37.3475 -120.9752
37.3475 -120.9752
37.3475 -120.9752
37.3475 -120.9752
37.3475 -120.9752
37.3475 -120.9751
37.3475 -120.9751
37.3477 -120.9747
37.348 -120.9745
37.3482 -120.9743
37.3484 -120.9743
37.3486 -120.9744
37.3487 -120.9746
37.3489 -120.9748
37.349 -120.975
37.3491 -120.9754
37.3492 -120.9758
37.3494 -120.9762
37.3495 -120.9764
37.3498 -120.9766
37.3499 -120.9767
37.3501 -120.9768
37.3504 -120.9768
37.3509 -120.9769
37.3516 -120.977
37.3519 -120.977
37.3522 -120.9771
37.3525 -120.9772
37.3528 -120.9772
37.3531 -120.9772
37.3534 -120.9773
37.3537 -120.9773
37.3538 -120.9772
37.354 -120.9772
  
and

37.2943 -120.9174 127.3714
37.2943 -120.9174 127.3714
37.2943 -120.9174 127.3714
37.2943 -120.9174 127.3714
37.2943 -120.9174 127.3714
37.2943 -120.9174 127.3714
37.2943 -120.9174 127.3703
37.2943 -120.9174 127.3703
37.2943 -120.9174 127.3703
37.2943 -120.9174 127.3703
37.2943 -120.9174 127.3703
37.2943 -120.9174 127.3703
37.2943 -120.9174 127.3691
37.2943 -120.9174 127.3691
37.2943 -120.9174 127.3691
37.2943 -120.9174 127.3691
37.2943 -120.9174 127.3691
37.2943 -120.9175 127.3646
37.2944 -120.9177 127.3513
37.2944 -120.9178 127.3477
37.2945 -120.918 127.3328
37.2947 -120.9183 127.314
37.2948 -120.9185 127.2983
37.295 -120.9187 127.2805
37.2951 -120.9188 127.2716
37.2953 -120.9188 127.2551
37.2956 -120.9189 127.2348
37.2958 -120.9191 127.2152
37.296 -120.9194 127.1947
37.2959 -120.9197 127.179
37.2959 -120.92 127.1636
37.2958 -120.9203 127.1472
37.2957 -120.9206 127.1294
37.2955 -120.9209 127.108
37.2954 -120.9212 127.0881
37.2953 -120.9215 127.0678
37.2953 -120.9219 127.0466
37.2954 -120.9223 127.0259
37.2954 -120.9224 127.0182
37.2955 -120.9226 127.0095
37.2956 -120.9228 126.9928
37.2958 -120.9231 126.9742
37.296 -120.9233 126.9545
37.2962 -120.9236 126.9343
37.2964 -120.9238 126.9172
37.2967 -120.9239 126.897
37.297 -120.924 126.8771
37.2972 -120.924 126.8574
37.2976 -120.924 126.8366
37.2977 -120.924 126.8292
37.2977 -120.924 126.8259
37.2979 -120.9239 126.8117
37.2981 -120.9238 126.7979
37.2982 -120.9238 126.7915
37.2982 -120.9238 126.7915
37.2982 -120.9238 126.7915
37.2982 -120.9238 126.7915
37.2982 -120.9237 126.7896
37.2982 -120.9237 126.7896
37.2982 -120.9237 126.7881
37.2982 -120.9237 126.7869
37.2982 -120.9237 126.7858
37.2982 -120.9237 126.7847
37.2982 -120.9236 126.7828
37.2982 -120.9236 126.7799
37.2982 -120.9235 126.7761
37.2982 -120.9235 126.7725
37.2982 -120.9234 126.7678
37.2983 -120.9233 126.7629
37.2983 -120.9231 126.7545
37.2982 -120.923 126.7485
37.2982 -120.9229 126.7402
37.2982 -120.9227 126.7284
37.2983 -120.9224 126.7157
37.2983 -120.9224 126.7097
37.2984 -120.9223 126.7078
37.2984 -120.9222 126.6983
37.2985 -120.9221 126.6896
37.2987 -120.922 126.6754
37.2989 -120.922 126.6617
37.2992 -120.922 126.6439
37.2994 -120.922 126.6277
37.2997 -120.9219 126.6097
37.2999 -120.9219 126.5934
37.3002 -120.9218 126.5737
37.3004 -120.9218 126.5544
37.3007 -120.9217 126.5356
37.301 -120.9217 126.5148
37.3012 -120.9217 126.5
37.3013 -120.9217 126.497
37.3013 -120.9217 126.4939
37.3013 -120.9217 126.4924
37.3013 -120.9217 126.4913
37.3013 -120.9217 126.4913
37.3014 -120.9218 126.4894
37.3014 -120.9218 126.4879
37.3014 -120.9218 126.4879
37.3014 -120.9218 126.486
37.3014 -120.9218 126.486
37.3014 -120.9218 126.486
37.3014 -120.9218 126.486
37.3014 -120.9218 126.4845
37.3014 -120.9218 126.4845
37.3014 -120.9218 126.4845
37.3014 -120.9218 126.483
37.3014 -120.9218 126.4814
37.3014 -120.9218 126.4799
37.3014 -120.9218 126.4799
37.3014 -120.9218 126.4799
37.3014 -120.9218 126.4799
37.3014 -120.9218 126.4784
37.3014 -120.9218 126.4765
37.3014 -120.9218 126.4737
37.3014 -120.9218 126.4722
37.3014 -120.9218 126.4703
37.3014 -120.9218 126.467
37.3014 -120.9218 126.4652
37.3013 -120.9218 126.4636
37.3014 -120.9218 126.4621
37.3014 -120.9218 126.4621
37.3014 -120.9218 126.4606
37.3013 -120.9217 126.453
37.3014 -120.9217 126.4485
37.3016 -120.9218 126.4343
37.3018 -120.9218 126.4193
37.302 -120.9219 126.4044
37.3022 -120.9219 126.3879
37.3024 -120.922 126.3714
37.3027 -120.9221 126.3544
37.3029 -120.9222 126.3392
37.3031 -120.9223 126.3254
37.3032 -120.9225 126.3076
37.3034 -120.9228 126.2871
37.3036 -120.923 126.2695
37.3037 -120.9234 126.2496
37.3038 -120.9238 126.2286
37.3038 -120.9241 126.2104
37.3039 -120.9244 126.1928
37.304 -120.9246 126.1799
37.3042 -120.9248 126.1629
37.3045 -120.9249 126.1438
37.3048 -120.9249 126.1259
37.305 -120.9248 126.1063
37.3052 -120.9247 126.0896
37.3055 -120.9247 126.0746
37.3056 -120.9248 126.0614
37.3058 -120.925 126.0447
37.3059 -120.9252 126.0326
37.3058 -120.9255 126.0167
37.3057 -120.9258 126.0008
37.3056 -120.9259 125.9856
37.3054 -120.9261 125.9689
37.3054 -120.9263 125.9581
37.3056 -120.9264 125.9462
37.3058 -120.9265 125.9313
37.306 -120.9265 125.9178
37.3062 -120.9264 125.9013
37.3064 -120.9263 125.883
37.3066 -120.9261 125.8659
37.3069 -120.926 125.8489
37.3071 -120.9259 125.8337
37.3072 -120.9258 125.8205
37.3074 -120.9257 125.8068
37.3076 -120.9257 125.7934
37.3078 -120.9257 125.7813
37.3079 -120.9256 125.7752
37.3081 -120.9257 125.7629
37.3082 -120.9258 125.7504
37.3084 -120.926 125.7371
37.3084 -120.9262 125.7261
37.3084 -120.9264 125.7142
37.3084 -120.9267 125.6966
37.3084 -120.927 125.6801
37.3083 -120.9273 125.6631
37.3082 -120.9276 125.6466
37.3081 -120.9278 125.6309
37.3079 -120.928 125.6142
37.308 -120.9282 125.6038
37.3081 -120.9283 125.5962
37.3081 -120.9285 125.5826
37.3082 -120.9287 125.5686
37.3084 -120.9288 125.5572
37.3086 -120.929 125.5428
37.3088 -120.9292 125.5246
37.309 -120.9293 125.5057
37.3091 -120.9295 125.4926
37.3092 -120.9296 125.4824
37.3092 -120.9297 125.4795
37.3091 -120.9293 125.5
37.3091 -120.9293 125.4981
37.3091 -120.9293 125.4951
37.3089 -120.9292 125.4826
37.3088 -120.9292 125.475
37.3088 -120.9293 125.4684
37.3088 -120.9293 125.4661
37.3088 -120.9293 125.4595
37.309 -120.9293 125.4472
37.3092 -120.9295 125.4301
37.3093 -120.9295 125.4208
37.3095 -120.9297 125.4076
37.3096 -120.9299 125.3938
37.3097 -120.9301 125.3818
37.3098 -120.9303 125.3669
37.3099 -120.9304 125.3557
37.3101 -120.9307 125.3381
37.3102 -120.9309 125.3233
37.3104 -120.9311 125.3076
37.3105 -120.9313 125.2924
37.3108 -120.9314 125.2759
37.3109 -120.9314 125.2625
37.3111 -120.9313 125.25
37.3114 -120.9312 125.2322
37.3116 -120.9314 125.2148
37.3118 -120.9316 125.197
37.3119 -120.9318 125.1822
37.3121 -120.9319 125.1701
37.3121 -120.9321 125.1585
37.3121 -120.9323 125.1468
37.3121 -120.9325 125.1373
37.3121 -120.9327 125.1265
37.3121 -120.9329 125.1146
37.3121 -120.9332 125.0992
37.3121 -120.9335 125.0828
37.312 -120.9338 125.0661
37.312 -120.9341 125.0468
37.3119 -120.9344 125.0297
37.3118 -120.9348 125.0104
37.3118 -120.9351 124.9938
37.3117 -120.9354 124.9756
37.3117 -120.9358 124.9536
37.3116 -120.9361 124.9345
37.3114 -120.9364 124.914
37.3113 -120.9367 124.8973
37.3112 -120.9369 124.8852
37.3112 -120.9369 124.8833
37.3111 -120.937 124.875
37.311 -120.9372 124.8638
37.311 -120.9374 124.8528
37.3108 -120.9376 124.835
37.3107 -120.9379 124.8163
37.3105 -120.9382 124.7996
37.3105 -120.9384 124.7837
37.3105 -120.9388 124.7648
37.3106 -120.9391 124.7449
37.3108 -120.9394 124.7246
37.3109 -120.9397 124.7059
37.3111 -120.9399 124.6888
37.3114 -120.94 124.6697
37.3117 -120.94 124.6504
37.312 -120.94 124.6295
37.3122 -120.94 124.6102
37.3125 -120.9399 124.5932
37.3127 -120.9398 124.5794
37.3129 -120.9397 124.5655
37.313 -120.9395 124.5504
37.3132 -120.9393 124.5341
37.3134 -120.9391 124.517
37.3136 -120.9389 124.4985
37.3138 -120.9386 124.4771
37.3139 -120.9383 124.4557
37.3141 -120.938 124.4371
37.3142 -120.9378 124.4227
37.3144 -120.9377 124.4089
37.3146 -120.9376 124.3943
37.3148 -120.9376 124.3794
37.3151 -120.9376 124.3631
37.3153 -120.9376 124.3464
37.3155 -120.9377 124.3305
37.3157 -120.9378 124.314
37.3159 -120.938 124.297
37.3161 -120.9383 124.2794
37.3162 -120.9386 124.2616
37.3162 -120.9389 124.2447
37.3161 -120.9391 124.2282
37.3161 -120.9394 124.2104
37.3162 -120.9397 124.1955
37.3164 -120.9398 124.1784
37.3167 -120.9397 124.1597
37.3169 -120.9395 124.1396
37.3172 -120.9394 124.1189
37.3174 -120.9392 124.1013
37.3175 -120.9389 124.0854
37.3176 -120.9387 124.0689
37.3178 -120.9383 124.0481
37.3178 -120.938 124.0282
37.3178 -120.9376 124.0093
37.3178 -120.9373 123.9903
37.3178 -120.9369 123.9712
37.3178 -120.9366 123.9511
37.3177 -120.9362 123.9294
37.3176 -120.9358 123.9087
37.3175 -120.9355 123.8873
37.3173 -120.9352 123.8697
37.3172 -120.9352 123.8638
37.3171 -120.9352 123.8549
37.317 -120.9352 123.8443
37.3167 -120.9351 123.8256
37.3165 -120.9348 123.8034
37.3166 -120.9343 123.7782
37.3168 -120.934 123.757
37.317 -120.9338 123.7369
37.3172 -120.9337 123.7195
37.3174 -120.9336 123.7074
37.3177 -120.9337 123.6866
37.3179 -120.9338 123.6706
37.3181 -120.934 123.6547
37.3182 -120.9342 123.6411
37.3183 -120.9344 123.6309
37.3183 -120.9345 123.6216
37.3185 -120.9347 123.6064
37.3187 -120.9349 123.5898
37.3188 -120.9351 123.5722
37.319 -120.9353 123.5559
37.3193 -120.9354 123.5371
37.3195 -120.9356 123.5193
37.3198 -120.9357 123.5019
37.32 -120.9357 123.4837
37.3202 -120.9358 123.467
37.3205 -120.9358 123.4477
37.3208 -120.9357 123.4278
37.3211 -120.9356 123.4091
37.3213 -120.9354 123.3909
37.3215 -120.9353 123.3746
37.3217 -120.9351 123.3583
37.3219 -120.9351 123.3419
37.3221 -120.9352 123.3263
37.3223 -120.9354 123.3106
37.3225 -120.9355 123.2955
37.3227 -120.9357 123.2784
37.3229 -120.9359 123.2606
37.3231 -120.9362 123.242
37.3232 -120.9364 123.2244
37.3234 -120.9367 123.2059
37.3235 -120.937 123.1873
37.3237 -120.9373 123.167
37.3238 -120.9376 123.1475
37.3239 -120.9379 123.1288
37.324 -120.9381 123.1167
37.324 -120.9382 123.1117
37.324 -120.9382 123.1106
37.324 -120.9383 123.1087
37.324 -120.9384 123.1017
37.3241 -120.9386 123.089
37.324 -120.9388 123.0769
37.3239 -120.9391 123.0604
37.3238 -120.9393 123.0409
37.3236 -120.9396 123.0242
37.3235 -120.9398 123.0083
37.3234 -120.9401 122.993
37.3233 -120.9404 122.9748
37.3233 -120.9408 122.9547
37.3233 -120.9412 122.9333
37.3232 -120.9415 122.9165
37.3232 -120.9418 122.9008
37.3231 -120.9421 122.8809
37.3229 -120.9423 122.8633
37.3227 -120.9426 122.8402
37.3225 -120.943 122.8152
37.3222 -120.9433 122.7919
37.322 -120.9436 122.7723
37.3219 -120.9439 122.75
37.3218 -120.9444 122.7199
37.3219 -120.945 122.6886
37.3221 -120.9454 122.6608
37.3225 -120.9456 122.6311
37.3229 -120.9456 122.6059
37.3231 -120.9453 122.5826
37.3232 -120.9449 122.5617
37.3233 -120.9446 122.5403
37.3235 -120.9442 122.518
37.3238 -120.9439 122.4909
37.3241 -120.9436 122.4633
37.3244 -120.9433 122.4367
37.3246 -120.9431 122.4184
37.3249 -120.9431 122.4
37.3252 -120.9429 122.3748
37.3256 -120.9427 122.3464
37.326 -120.9426 122.3188
37.3264 -120.9424 122.2926
37.3268 -120.9425 122.2598
37.3271 -120.9428 122.2322
37.3272 -120.9431 122.2129
37.3273 -120.9434 122.1964
37.3274 -120.9436 122.1822
37.3275 -120.9439 122.1636
37.3277 -120.9442 122.1451
37.3278 -120.9445 122.1252
37.3279 -120.9449 122.1011
37.3281 -120.9453 122.0765
37.3283 -120.9457 122.0506
37.3286 -120.9461 122.0225
37.329 -120.9462 121.9938
37.3294 -120.9463 121.9629
37.3298 -120.9465 121.9377
37.3301 -120.9466 121.9146
37.3305 -120.9466 121.8879
37.3309 -120.9463 121.8574
37.3313 -120.946 121.8241
37.3314 -120.9455 121.7955
37.3316 -120.9449 121.7627
37.3316 -120.9444 121.732
37.3316 -120.944 121.7119
37.3314 -120.9439 121.7027
37.3314 -120.9438 121.6962
37.3313 -120.9438 121.6852
37.3309 -120.9436 121.6621
37.3307 -120.9434 121.6424
37.331 -120.9434 121.6244
37.3313 -120.9431 121.5966
37.3316 -120.943 121.5763
37.3319 -120.9429 121.5572
37.3321 -120.9429 121.5379
37.3325 -120.943 121.5131
37.3327 -120.9434 121.4888
37.3326 -120.9438 121.4689
37.3323 -120.944 121.4481
37.3321 -120.9442 121.4265
37.3319 -120.9445 121.4051
37.3317 -120.9448 121.3837
37.3317 -120.9452 121.3646
37.3318 -120.9454 121.347
37.3319 -120.9458 121.3267
37.3319 -120.9462 121.303
37.3318 -120.9466 121.2828
37.3315 -120.9468 121.2595
37.3313 -120.9471 121.2345
37.3312 -120.9475 121.2119
37.3314 -120.9479 121.1883
37.3316 -120.9481 121.1686
37.3317 -120.948 121.1625
37.3318 -120.9481 121.158
37.3318 -120.9481 121.1551
37.3318 -120.9481 121.1532
37.3319 -120.9482 121.1432
37.3319 -120.9484 121.1348
37.332 -120.9484 121.1303
37.332 -120.9483 121.1292
37.332 -120.9484 121.1233
37.3319 -120.9487 121.1091
37.3319 -120.9492 121.0778
37.3317 -120.9498 121.0434
37.3316 -120.9504 121.0125
37.3316 -120.9509 120.9864
37.3314 -120.9513 120.9612
37.3314 -120.9515 120.9496
37.3314 -120.9516 120.9426
37.3314 -120.9518 120.9331
37.3314 -120.9519 120.9244
37.3314 -120.9522 120.9123
37.3314 -120.9522 120.9087
37.3314 -120.9522 120.9068
37.3314 -120.9524 120.9009
37.3313 -120.9524 120.8943
37.3314 -120.9526 120.8888
37.3314 -120.9528 120.8723
37.3316 -120.953 120.8572
37.3317 -120.9531 120.8496
37.3318 -120.9531 120.8436
37.3318 -120.9531 120.8403
37.3319 -120.9531 120.8388
37.3319 -120.9531 120.8388
37.3318 -120.9531 120.8369
37.3319 -120.9531 120.8339
37.332 -120.9532 120.8229
37.3323 -120.9532 120.8064
37.3325 -120.953 120.7845
37.3328 -120.9528 120.7629
37.333 -120.9526 120.7439
37.3333 -120.9524 120.7203
37.3336 -120.9522 120.6983
37.3339 -120.9522 120.6758
37.3343 -120.9522 120.6504
37.3347 -120.9524 120.6227
37.335 -120.9526 120.5968
37.3353 -120.9529 120.5725
37.3354 -120.9531 120.5585
37.3354 -120.9532 120.5502
37.3355 -120.9533 120.5464
37.3355 -120.9533 120.5426
37.3355 -120.9537 120.5214
37.3354 -120.9543 120.489
37.3352 -120.9548 120.4593
37.3349 -120.9551 120.4286
37.3347 -120.9556 120.4006
37.3348 -120.9561 120.3701
37.3352 -120.9566 120.3345
37.3355 -120.957 120.3021
37.3359 -120.9573 120.2701
37.3362 -120.9578 120.2358
37.3366 -120.9582 120.2025
37.337 -120.9584 120.1686
37.3371 -120.9587 120.1527
37.3369 -120.9591 120.128
37.3366 -120.9595 120.0955
37.3362 -120.9599 120.0614
37.3357 -120.96 120.0248
37.3353 -120.9601 119.9979
37.335 -120.96 119.9754
37.3345 -120.9601 119.9409
37.3344 -120.9602 119.9345
37.3342 -120.9604 119.915
37.3339 -120.9608 119.8805
37.3338 -120.9613 119.8557
37.334 -120.9613 119.8422
37.3344 -120.9617 119.8123
37.3345 -120.962 119.7938
37.3347 -120.9625 119.7617
37.335 -120.963 119.7256
37.3352 -120.9635 119.6932
37.3353 -120.9639 119.6733
37.3354 -120.9639 119.6678
37.3354 -120.9641 119.6583
37.3354 -120.9644 119.6424
37.3356 -120.9648 119.6199
37.3357 -120.9651 119.604
37.3357 -120.9651 119.5994
37.3358 -120.9652 119.59
37.3359 -120.9653 119.5799
37.3362 -120.9656 119.5591
37.3367 -120.9656 119.5244
37.337 -120.9661 119.4919
37.3376 -120.9674 119.4057
37.3366 -120.9672 119.3377
37.3364 -120.9678 119.3004
37.3362 -120.9682 119.2723
37.3362 -120.9683 119.2686
37.3362 -120.9683 119.2674
37.3362 -120.9682 119.2652
37.3362 -120.9682 119.2652
37.3362 -120.9682 119.264
37.3362 -120.9683 119.2591
37.3362 -120.9685 119.2472
37.3362 -120.9688 119.2341
37.3362 -120.9689 119.2269
37.3362 -120.969 119.2208
37.3364 -120.9693 119.1977
37.3368 -120.9697 119.165
37.3372 -120.9699 119.1316
37.3376 -120.9702 119.0994
37.3381 -120.9705 119.0648
37.3385 -120.9708 119.0311
37.3388 -120.9711 119.007
37.3389 -120.9715 118.9816
37.3388 -120.9718 118.9602
37.3388 -120.9719 118.9545
37.3387 -120.972 118.9489
37.3387 -120.972 118.9473
37.3386 -120.972 118.9417
37.3384 -120.9723 118.9203
37.3382 -120.9726 118.8979
37.3381 -120.9729 118.878
37.3382 -120.9732 118.8593
37.3384 -120.9734 118.8383
37.3388 -120.9734 118.8144
37.3391 -120.9732 118.7898
37.3395 -120.973 118.7633
37.3398 -120.9727 118.7369
37.3401 -120.9727 118.7146
37.3404 -120.9729 118.6926
37.3407 -120.9734 118.6612
37.3409 -120.9738 118.6343
37.341 -120.9742 118.6087
37.341 -120.9747 118.5837
37.341 -120.9751 118.5576
37.3408 -120.9756 118.5307
37.3404 -120.9758 118.5049
37.3402 -120.9761 118.4818
37.3401 -120.9765 118.4619
37.3403 -120.9767 118.4434
37.3406 -120.9768 118.4242
37.3409 -120.9771 118.4009
37.3411 -120.9773 118.3775
37.3412 -120.9778 118.3508
37.3412 -120.9782 118.3282
37.3416 -120.9785 118.3025
37.3419 -120.9787 118.2782
37.3423 -120.9785 118.2494
37.3423 -120.978 118.2235
37.3425 -120.9776 118.1953
37.3426 -120.9772 118.1739
37.3428 -120.977 118.1553
37.3429 -120.9769 118.1496
37.343 -120.9769 118.1415
37.3431 -120.9768 118.1377
37.3431 -120.9768 118.1377
37.3431 -120.9768 118.1366
37.3431 -120.9768 118.1354
37.3431 -120.9768 118.1354
37.3431 -120.9768 118.1309
37.3431 -120.9768 118.1271
37.3434 -120.9767 118.1116
37.3438 -120.9764 118.0818
37.3441 -120.9763 118.0544
37.3445 -120.976 118.0233
37.345 -120.9758 117.9903
37.3452 -120.9758 117.9725
37.3453 -120.9758 117.9665
37.3455 -120.9758 117.9545
37.3456 -120.9758 117.9456
37.3459 -120.9759 117.9258
37.3463 -120.9762 117.8955
37.3466 -120.9767 117.8621
37.3469 -120.9765 117.8352
37.3471 -120.9758 117.7968
37.3472 -120.9752 117.758
37.3474 -120.9746 117.7244
37.3477 -120.9742 117.6947
37.3482 -120.9742 117.6606
37.3487 -120.9746 117.6167
37.349 -120.9751 117.5833
37.3493 -120.9758 117.5439
37.3496 -120.9765 117.4981
37.3501 -120.9768 117.4566
37.3506 -120.9769 117.4222
37.351 -120.9769 117.3938
37.3513 -120.9769 117.3758
37.3517 -120.977 117.3487
37.3521 -120.977 117.3205
37.3526 -120.9769 117.2877
37.3531 -120.977 117.2521
37.3536 -120.977 117.218
37.3541 -120.9769 117.182
37.3546 -120.9768 117.1477
37.3551 -120.9769 117.1131
37.3555 -120.977 117.0833
37.3558 -120.977 117.0638
37.3561 -120.9771 117.0394
37.3564 -120.9773 117.0152
37.3567 -120.9775 116.9943
37.3569 -120.9779 116.9703
37.357 -120.9784 116.9417
37.3572 -120.9788 116.9163
37.3575 -120.9789 116.8911
37.3579 -120.9789 116.8659
37.3582 -120.9789 116.8386
37.3587 -120.9788 116.8102
37.3591 -120.9788 116.7835
37.3594 -120.9789 116.7604
37.3598 -120.979 116.7328
37.3602 -120.979 116.703
37.3606 -120.9788 116.6705
37.3611 -120.9786 116.6362
37.3616 -120.9785 116.6017
37.362 -120.9786 116.572
37.3624 -120.9787 116.5472
37.3627 -120.9789 116.5216
37.3631 -120.9791 116.4956
37.3634 -120.9793 116.4699
37.3637 -120.9796 116.4403
37.3641 -120.98 116.4087
37.3643 -120.9805 116.3788
37.3646 -120.981 116.3455
37.3649 -120.9814 116.3091
37.3654 -120.9818 116.2701
37.3659 -120.9818 116.2375
37.3663 -120.9815 116.2064
37.3668 -120.981 116.164
37.3671 -120.9804 116.1233
37.3674 -120.9795 116.0712
37.3676 -120.9787 116.0241
37.3678 -120.978 115.9841
37.3678 -120.9775 115.9568
37.3676 -120.9771 115.9265
37.3672 -120.9764 115.8831
37.3669 -120.9756 115.8341
37.3672 -120.975 115.7938
37.3676 -120.9749 115.7655
37.368 -120.9744 115.7229
37.3684 -120.9739 115.6866
37.3687 -120.9736 115.6608
37.3691 -120.9733 115.6299
37.3693 -120.9732 115.6148
37.3693 -120.9732 115.6129
37.3693 -120.9731 115.6117
37.3693 -120.9731 115.6102
37.3693 -120.9731 115.6091
37.3694 -120.9731 115.6059
37.3695 -120.9731 115.5939
37.3699 -120.9732 115.5652
37.3704 -120.9737 115.5216
37.3706 -120.9743 115.4847
37.3706 -120.975 115.4504
37.3706 -120.9756 115.4148
37.3702 -120.9761 115.3788
37.37 -120.9768 115.3419
37.3699 -120.9773 115.3108
37.37 -120.9777 115.2866
37.3702 -120.9783 115.2545
37.3705 -120.9787 115.2235
37.371 -120.9788 115.1913
37.3715 -120.9789 115.154
37.3721 -120.9788 115.1152
37.3725 -120.9786 115.0822
37.373 -120.9784 115.0466
37.3735 -120.9782 115.0108
37.374 -120.9782 114.9737
37.3746 -120.978 114.9328
37.3751 -120.9777 114.8922
37.3754 -120.9774 114.865
37.3757 -120.9769 114.8297
37.3761 -120.9761 114.7805

Here is the data I am using for this. If you plot the data you will see that linear interpolation won't work due to the river meanders. All I am trying to do is to interpolate the rivermile (3rd column) onto the first set of data so that the lat/longs can be referenced with a rivermile of their own.

Subject: River miles

From: Andrew Stevens

Date: 5 Dec, 2008 00:51:02

Message: 25 of 26

...
> Here is the data I am using for this. If you plot the data you will see that linear interpolation won't work due to the river meanders. All I am trying to do is to interpolate the rivermile (3rd column) onto the first set of data so that the lat/longs can be referenced with a rivermile of their own.

Looks like your the dataset with the river miles is higher resolution than the GPS points you took...This probably is not the best idea, but may be a workaround if you can't get interpolation to work. You could just find the closest points in your second data set to the points in your first dataset.

suppose your first dataset is stored in variable "data" and the second one (with the river miles) is stored in variable "xyr'.

xd=cellfun(@(x)(abs(x-xyr(:,2))),...
    num2cell(data(:,2)),'uni',0);
yd=cellfun(@(x)(abs(x-xyr(:,1))),...
    num2cell(data(:,1)),'uni',0);
[distr,ind]=cellfun(@(x,y)(min(sqrt(x.^2+y.^2))),xd,yd);

riverMile=xym(ind,3);

%check the results
figure
scatter(data(:,2),data(:,1),40,riverMile);
hold on
scatter(xyr(:,2),xyr(:,1),20,xyr(:,3),'filled')

P.S. Dont try this with a large dataset...

Andrew

Subject: River miles

From: Alan B

Date: 12 Dec, 2008 20:55:04

Message: 26 of 26

Why can't you just griddata? I copied the data you posted here, stored it in rivermiles.txt and rivermiles2.txt, then ran this:



fid = fopen('rivermiles.txt'); d1=fscanf(fid,'%f %f'); fclose(fid);
fid = fopen('rivermiles2.txt'); d2=fscanf(fid,'%f %f %f'); fclose(fid);
d1 = reshape(d1,2,length(d1)/2);
d2 = reshape(d2,3,length(d2)/3);
t1 = 1:length(d1);
t2 = 1:length(d2);

d3 = griddata(d2(1,:),d2(2,:),d2(3,:),d1(1,:),d1(2,:));

figure(10), clf
subplot(231), plot(t1,d1(1,:),t2,d2(1,:)), title('y')
subplot(234), plot(t1,d1(2,:),t2,d2(2,:)), title('x')
subplot(232), plot(t2,d2(3,:),t1,d3), title('dist')
subplot(233),plot(d2(2,:),d2(1,:),'y.',d1(2,:),d1(1,:),'ro'), title('spatial')

figure(11), clf
plot3(d2(2,:),d2(1,:),d2(3,:),'y.')
plot3(d1(2,:),d1(1,:),d3,'ro')


and the 3d plot looked correct to me, as seen here: http://img128.imageshack.us/img128/3489/rivermilesfp3.png (hopefully that is self explanatory)

But I must have missed something...

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
interpolation Ned Gulley 21 Nov, 2008 23:00:25
rssFeed for this Thread

Public Submission Policy

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.

Contact us at files@mathworks.com