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

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Laura Platchkov
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/
Reply | Threaded
Open this post in threaded view
|

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

Austin Nichols
Laura Platchkov<[hidden email]> :
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<[hidden email]> 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/
Reply | Threaded
Open this post in threaded view
|

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

Roy Wada
In reply to this post by Laura Platchkov
You should be able to export data points as dbf, which you can import
into Stata. May be -ship2dta- will do this. I don't know.
 
You can take the twenty closest points and see if they are from the multiple
lakes. You can see if the house was located next to a narrow strip or not.
 
If someone is claiming expertise on this topic, that centroid is bad or not so bad,
please do let me know how to do this properly because I would be interested.
 
Roy

> 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.
>
> Laura
_________________________________________________________________
Windows Live: Keep your friends up to date with what you do online.
http://windowslive.com/Campaign/SocialNetworking?ocid=PID23285::T:WLMTAGL:ON:WL:en-US:SI_SB_online:082009
*
*   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/
Reply | Threaded
Open this post in threaded view
|

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

Laura Platchkov
In reply to this post by Laura Platchkov
Thanks Roy!

But my problem was rather that I have shapefile with polygons, and to transfer them into .dta, I dont know any other way that using shp2dta, which automatically computes the centroids of the polygones.

As my polygones are lakes, and some are quite big, computing  the distance from the house to the center of the polygone would not be the most realistic, but I don't know how to do it differently.

It would be better to find a way to transfer the shapefile into .dta without automatically computing the centroid of the polygone, but I dont know how to do it.

Anyone an idea?

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/
Reply | Threaded
Open this post in threaded view
|

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

Roy Wada
> But my problem was rather that I have shapefile with polygons, and to transfer them
> into .dta, I dont know any other way that using shp2dta, which automatically computes
> the centroids of the polygones.

The help file for -shp2dta- says that it will compute the centroids if
-gencentroids( )- option is specified.
 
If this is the case, just leave it out.
 
It may be that both .shp and .dbf files are required.
 
Roy
 
_________________________________________________________________
Hotmail: Powerful Free email with security by Microsoft.
http://clk.atdmt.com/GBL/go/171222986/direct/01/
*
*   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/