Hi everyone,

I'm using PostgreSQL + postgis.

In web2py, in the model, define the table localidades:

tb_localidades = db.define_table('localidades',
    Field('nombre', length=100),
    ...
    Field('alias', length=50, comment='Un Ășnico nombre'),
    ...
    Field('datos', 'upload', autodelete=True, label='Datos
(shapefile)', comment='Usar los tres archivos (.shp, .shx y .dbf)
zipeados'),
    ...
    format='%(nombre)s'
)

Each row in localidades has an associated shapefile [1], which is
uploaded to the server. This shapefile is migrated to the database
with the command shp2pgsql (all this happens on the server).

alias field is used as the name of the table (with geographical
attributes) migrated.

I have 2 problems:

1) The only connection between the localidad and the geographical
table migrated, is the field  alias. This somehow I could fix by
altering the table or sql that generates the table.

2) This is to me more difficult to solve. What I want is that the new
geographical table is included in the model dynamically. This table
has no fixed structure is defined by the shapefile associated with the
localidad.

Is there any way to include every geography table associated to the
localidad, within the model (dynamically)?

Jose


[1] http://en.wikipedia.org/wiki/Shapefile

Reply via email to