[postgis-devel] Geocoder geometry_columns

Paragon Corporation lr at pcorp.us
Thu Oct 14 15:44:29 PDT 2010


No it doesn't.  Never rally had a need for it showing as far as geocoding is
concerned.

It does have the constraints in place for each table since constraints are
inherited, so in PostGIS 2.0 I do see them in geometry_columns since in 2.0
geometry_columns is just a view that reads constraints or typmod.

I don't want to insert into geometry_columns because that would break
PostGIS 2.0.

You'd be safer running populate_geometry_columns()  since that would work
for both PostGIS 1.5 and be ignored for tables that already have constraints
or typmod in 2.0.

Thanks,
Regina 

-----Original Message-----
From: postgis-devel-bounces at postgis.refractions.net
[mailto:postgis-devel-bounces at postgis.refractions.net] On Behalf Of
maplabs at light42.com
Sent: Thursday, July 14, 2011 3:51 PM
To: postgis-devel at postgis.refractions.net
Subject: [postgis-devel] Geocoder geometry_columns

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()


_______________________________________________
postgis-devel mailing list
postgis-devel at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-devel





More information about the postgis-devel mailing list