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

George Pavlov gpavlov at mynewplace.com
Mon Nov 12 23:53:04 PST 2007


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