[postgis-devel] Geocoder geometry_columns

Paragon Corporation lr at pcorp.us
Thu Oct 14 15:47:54 PDT 2010


 
One caveat to what I said.  PostGIS 1.5 populate_geometry_columns uses
deprecated functions we got rid of in 2.0.

Just occurred to me I don't think we fixed that in PostGIS 1.5.3. I'll add
that to the to-do  for 1.5.4.

Though still for this case it would work fine, since it would discover
already compatible constraints and just add the entries to geometry_columns
table, so it would still do the right thing in 1.5 and do nothing in 2.0

Thanks for the reminder Brian.

Regina
-----Original Message-----
From: Paragon Corporation [mailto:lr at pcorp.us] 
Sent: Thursday, July 14, 2011 6:50 PM
To: 'PostGIS Development Discussion'
Subject: RE: [postgis-devel] Geocoder geometry_columns

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