Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!s9g2000prm.googlegroups.com!not-for-mail
From: NZTideMan <mulgor@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: River miles
Date: Mon, 17 Nov 2008 17:13:06 -0800 (PST)
Organization: http://groups.google.com
Lines: 11
Message-ID: <4521b8d9-2021-4ff0-b430-08822a0ce2bc@s9g2000prm.googlegroups.com>
References: <gfst52$caq$1@fred.mathworks.com>
NNTP-Posting-Host: 121.72.84.73
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Trace: posting.google.com 1226970786 20380 127.0.0.1 (18 Nov 2008 01:13:06 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Tue, 18 Nov 2008 01:13:06 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: s9g2000prm.googlegroups.com; posting-host=121.72.84.73; 
	posting-account=qPexFwkAAABOl8VUndE6Jm-9Z5z_fSpR
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.18) 
	Gecko/20081029 Firefox/2.0.0.18,gzip(gfe),gzip(gfe)
X-HTTP-Via: 1.1 nc4 (NetCache NetApp/6.0.5P1)
Xref: news.mathworks.com comp.soft-sys.matlab:501322


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.