| Date: | Wed, 2 Apr 1997 10:26:18 +0000 |
| Reply-To: | "Keith J. Brown" <kjb@GA.UNC.EDU> |
| Sender: | "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU> |
| From: | "Keith J. Brown" <kjb@GA.UNC.EDU> |
| Organization: | The University of North Carolina at Chapel Hill |
| Subject: | 2 Mapping Questions |
| Content-Type: | text/plain; charset=us-ascii |
Hi all,
I've got a couple of questions relating to mapping in SAS, and
hope someone out there can help.
First, does anyone have a good formula for calculating distance
between two points? Currently, I'm using the following, but would
appreciate a formula that has a little more solid cartographical
foundation:
longlen=69*(cos(lat*arcos(-1)/180));
y1len=69*(cos(lat1*arcos(-1)/180));
distx=69*(lat1-lat);
disty=(long1-long)*((longlen+y1len)/2);
distance=round(sqrt(sum(distx**2,disty**2)));
Secondly, is there formula/method/macro for determining if a point
lies inside a given irregular polygon (i.e., a county or state)? I have
a dataset with information on several thousand cities and towns, but
it doesn't include county FIPS number. I'd like to be able to merge it
with the mapping data from SAS and keep only the localities that are
within the boundaries of a particular county. At the moment, I'm
using a rather kludgy method that I would much rather replace. Any
pointers to good cartographic texts would also be appreciated.
Thanks,
Keith
|