[postgis-users] US zip code bounding boxes/ZCTA sizes

George Pavlov gpavlov at mynewplace.com
Wed Nov 14 15:46:36 PST 2007


Steve,

I was not looking for a centroid/minimum bounding circle solution,
which, of course, would be the more precise approach. For my limited
purposes I was happy with zip/ZCTA extents (bounding box based on the
min and max lats and longs of the points defining the polygon) and Lee
Keel graciously provided that.

Thanks for your replies!

George
 

> -----Original Message-----
> From: postgis-users-bounces at postgis.refractions.net 
> [mailto:postgis-users-bounces at postgis.refractions.net] On 
> Behalf Of Stephen Woodbridge
> Sent: Tuesday, November 13, 2007 10:06 AM
> To: PostGIS Users Discussion
> Subject: Re: [postgis-users] US zip code bounding boxes/ZCTA sizes
> 
> George,
> 
> This is a simple(?) minimization problem if you want the best 
> solution. 
> You want to find the point in space the minimizes the distance to all 
> the points in the polygon. This could probably be done with synthetic 
> annealing where you start with the polygon centroid and then 
> interates 
> the circle center and minimizes the the area of the circle 
> naded on the 
> radius being the distance to the farthest polygon node.
> 
> There is not exact solution. You might be able to use the 
> centroid as an 
> approximation and compute the radius to the farthest node.
> 
> -Steve
> 
> George Pavlov wrote:
> > This is not strictly a PostGIS question, but I thought some 
> kind soul
> > here can help me since at least some folks on this list are 
> likely to
> > have this kind of data handy: I need to find the smallest minimum
> > bounding box circle that could fit any US ZIP code (or a ZCTA to be
> > precise). So basically can someone with ZCTA polygon data 
> run something
> > along these lines for me and tell me the result:
> > 
> > select max(diagonal_length)
> > from (
> >   select
> >     your_distance_fn (
> >       min(lat), min(long),
> >       max(lat), max(long)
> >     ) as diagonal_length
> >   from your_zip_code_table
> >   group by zip_code
> > ) x
> > ;
> > 
> > Even nicer would be if you could send me the output of the 
> inner select
> > so I can do some more analysis. Something like this maybe:
> > 
> > select
> >   zip_code,
> >   min(lat),
> >   min(long),
> >   max(lat),
> >   max(long)
> > from your_zip_code_table
> > group by zip_code
> > ;
> > 
> > Thanks in advance!
> > 
> > George
 



More information about the postgis-users mailing list