Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# Re: st: Computing minimum driving distance to an area (rather than a specific point)

 From "Dimitriy V. Masterov" To statalist@hsphsun2.harvard.edu Subject Re: st: Computing minimum driving distance to an area (rather than a specific point) Date Mon, 16 Apr 2012 10:30:54 -0400

```I just realized that I left out the part about how you would read in
the shapefiles into Stata. You need a command from ssc called shp2dta
(or mif2dta if you have MapInfo format boundaries).

DVM

On Mon, Apr 16, 2012 at 9:46 AM, Dimitriy V. Masterov
<dvmaster@gmail.com> wrote:
> Jen,
>
> In a geometric sense, you can think of your municipalities as
> polygons. Every polygon has at least 4 distinct barycenters (i.e.,
> centers of mass), so there's no straightforward answer to your
> question.
>
> 1) The barycenter of its vertices.
> 2) The barycenter of its edges.
> 3) Its barycenter as a polygon, which can be obtained decomposing it
> into triangles. The area-weighted average of these barycenters is the
> polygon's barycenter.
> 4) X-weighted centroid, where X might be a people or blocks or block groups.
>
> These may coincide in special cases, but are generally distinct
> points. It may also happen that many of these centers are not
> necessarily located within the interior of a polygon. Hopefully your
> municipalities will be mostly convex, so this should be less of a
> problem. You do have to worry that your barrycenter is in the middle
> of lake, for example.
>
> The three types differ on where the mass is presumed located: it
> either is entirely on the vertices, spread uniformly on the edges, or
> spread throughout the polygon itself, either uniformly or not.
>
> You might be able to hack such calculations in Stata using the
> coordinates file that you create when you convert the shapefile for
> the municipal boundaries, but I think there's an easier way. I would
> get the shapefile for the municipalities. Such files will usually have
> columns for the lat and lon of the centroid. It's what ArcGIS uses
> when you choose to label an area. Use that as your center.
> Alternatively, you might want to see if you can track down a
> population-weighted centroid as that seems relevant to your problem.
> From then, it will just be a simple merge.
>
> HTH,
> DVM
*
*   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/
```