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

Stephen Woodbridge woodbri at swoodbridge.com
Tue Nov 13 10:06:00 PST 2007


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
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users




More information about the postgis-users mailing list