Geographic overlap calculations

shp2pgsql -s 4269 countyp020 county >county.sql
shp2pgsql -s 4269 hucs00p020 huc >huc.sql
shp2pgsql -s 4269 quad24 quad >quad.sql

create table cntyhuc as
  select c.fips,h.cat_num
  from county c, huc h
  where intersects(c.the_geom,h.the_geom);

create table cntyquad as
  select c.fips,q.q24code
  from county c, quad q
  where intersects(c.the_geom,q.the_geom);

create table quadhuc as
  select q.q24code,h.cat_num
  from quad q, huc h
  where intersects(q.the_geom,h.the_geom);

create table cntyfed as
  select c.fips,f.fedland_id
  from county c, fedland f
  where intersects(c.the_geom,f.the_geom);

Peter N. Schweitzer
U.S. Geological Survey Eastern Mineral Resources Team
USGS GIS 2008