[postgis-devel] Geocoder geometry_columns

maplabs at light42.com maplabs at light42.com
Thu Oct 14 12:44:46 PDT 2010


does the geocoder db have geometry_columns entries after it is built?
It was late at night and I wrote this.. could be useful

----

import psycopg2

all_pre = [
 'al','ar','az',
 'ca','co','ct',
 'dc', 'de', 'fl', 'ga',
 'ia', 'id', 'il', 'in',
 'ks', 'ky', 'la', 'ma',
 'md', 'me', 'mi', 'mn', 'mo', 'ms',
 'mt', 'nc', 'nd', 'ne', 'nh', 'nj',
 'nm', 'nv', 'oh', 'ok', 'or', 'pa',
 'ri', 'sc', 'sd', 'tn', 'tx', 
 'ut', 'va', 'vt', 'wa', 'wi', 'wv', 'wy'
]

all_tbls = {
  '_place' : 'MULTIPOLYGON',
  '_faces' : 'MULTIPOLYGON', 
  '_edges' : 'MULTILINESTRING',
  '_cousub' : 'MULTIPOLYGON',
  '_county' : 'MULTIPOLYGON'
}

##=============================================
conn = psycopg2.connect("dbname=geocoder")
curs = conn.cursor()

for tPre in all_pre:

    for tTble in all_tbls.keys():

        tSQL = '''  
INSERT INTO geometry_columns VALUES ('', 'tiger_data', '%s', 
'the_geom', 2, 4326, '%s');
        ''' % ( tPre + tTble, all_tbls[ tTble ] )

        curs.execute( tSQL )

    conn.commit()





More information about the postgis-devel mailing list