Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Fuzzy matching (so to say) based on geographical coordinates


From   Nils Braakmann <nilsbraakmann@googlemail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Fuzzy matching (so to say) based on geographical coordinates
Date   Mon, 13 Jun 2011 15:29:59 +0100

Austin, Dimitriy, thanks for the quick response! That should get me going.

Cheers,
Nils

On Mon, Jun 13, 2011 at 3:11 PM, Austin Nichols <austinnichols@gmail.com> wrote:
> Nils Braakmann <nilsbraakmann@googlemail.com>:
> The simplest way, to my mind, is to do an unmatched merge and loop
> over observations, e.g.
> http://www.stata.com/statalist/archive/2009-09/msg00473.html
>
> On Mon, Jun 13, 2011 at 9:52 AM, Nils Braakmann
> <nilsbraakmann@googlemail.com> wrote:
>> Hi everyone,
>>
>> I have the following problem I would appreciate some help with: I have
>> two data files, one containing the location of certain events, the
>> other containing centroids of regions. Locations in both cases are
>> defined by latitude and longitude (lat and lon). What I aim to do is
>> to match each event to the nearest region, where the definition of
>> "nearest" is based on the ellipsoidal distance between the two
>> coordinates. The distances themselves could be computed using
>> -geodist-by Robert Picard.
>>
>> The coordinates in both data sets look like:
>>    |      lat         lon |
>>     |----------------------|
>>  1. | 55.22918   -161.9152 |
>>  2. | 52.24265   -175.1298 |
>>  3. | 61.17837   -149.1864 |
>>  4. | 60.93916   -160.1473 |
>>  5. | 58.74463   -156.9881 |
>>
>> I presume one way to proceed would be to compute all pairwise
>> distances between every event and every region and keep the respective
>> minimum. However, as I would expect problems such as mine to appear
>> rather frequently in fields such as geography, I wonder whether anyone
>> knows of a simpler way or of a program/ado-file (might be outside of
>> Stata) that could do the job. I basically try to avoid reinventing the
>> wheel for something that might be a fairly standard problem.
>>
>> Cheers,
>> Nils
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index