Statalist


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

Re: st: Re: St: Re exact command for distance?


From   Austin Nichols <[email protected]>
To   [email protected]
Subject   Re: st: Re: St: Re exact command for distance?
Date   Fri, 11 Sep 2009 15:58:10 -0400

Laura Platchkov<[email protected]> :
N.B. there is no command per se, but in words: take the data with
points you want to compute minimum distance from, -merge- (not on
variables, just an unmatched merge) the data with shapes or points you
want to compute distance to, then loop over observations in the first
dataset: for each, compute distance to points in the second (if the
second is a shape file, you will be computing distance to the nearest
vertex of a polygon) and store the minimum distance to a variable you
have initialized as missing.  If you later decide you want other stuff
saved, you can add commands inside the loop to save that other stuff
(e.g. ID of nearest shape, or area of nearest shape, or number of
shapes within 50 miles, or what have you).

On Fri, Sep 11, 2009 at 10:33 AM, Laura Platchkov<[email protected]> wrote:
> Hi Austin,
>
> Yes I know, the centroid of a water bodies is not so exact, but how could I do it differently? I mean, the shapefile that I have are polygons, and when I transform it in .dta, with the shp2dta command, then STATA automatically computes the centroid.
>
> I computed some distances with distmatch, but I am open to another more realistic solution. Maybe i could try to find a shapefile which contains the limits of the water bodies as points...???
>
> Could you explain your command in words? If I understand well, it will give me the same results as the distmatch command, isnt'it?
>
> Thanks,
>
> Laura
>
>
*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index