declare geolocation fields in schema files (fixes #14572)
It's declared as a measure whose value is the array aggregate of the points.
This commit is contained in:
parent
c51d61e5ac
commit
437f4924d2
|
@ -24,3 +24,8 @@ cube.
|
||||||
--key KEY HMAC key for signatures
|
--key KEY HMAC key for signatures
|
||||||
--pg-dsn PG_DSN Psycopg2 DB DSN
|
--pg-dsn PG_DSN Psycopg2 DB DSN
|
||||||
--schema SCHEMA schema name
|
--schema SCHEMA schema name
|
||||||
|
|
||||||
|
Requirements
|
||||||
|
------------
|
||||||
|
|
||||||
|
PostgreSQL > 9.4 is required.
|
||||||
|
|
|
@ -227,6 +227,12 @@ class WcsOlapFeeder(object):
|
||||||
'count({fact_table}.id) * 100. / (select '
|
'count({fact_table}.id) * 100. / (select '
|
||||||
'count({fact_table}.id) from {table_expression} where '
|
'count({fact_table}.id) from {table_expression} where '
|
||||||
'{where_conditions}) end',
|
'{where_conditions}) end',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'geolocation',
|
||||||
|
'label': 'localisation géographique',
|
||||||
|
'type': 'point',
|
||||||
|
'expression': 'array_agg("{fact_table}".geolocation_base) FILTER (WHERE "{fact_table}".geolocation_base IS NOT NULL)',
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -383,6 +389,7 @@ CREATE TABLE public.dates AS (SELECT
|
||||||
['generic_status_id', 'smallint REFERENCES {generic_status_table} (id)'],
|
['generic_status_id', 'smallint REFERENCES {generic_status_table} (id)'],
|
||||||
['endpoint_delay', 'interval'],
|
['endpoint_delay', 'interval'],
|
||||||
['first_agent_id', 'smallint REFERENCES {agent_table} (id)'],
|
['first_agent_id', 'smallint REFERENCES {agent_table} (id)'],
|
||||||
|
['geolocation_base', 'POINT NULL'],
|
||||||
['json_data', 'JSONB NULL'],
|
['json_data', 'JSONB NULL'],
|
||||||
]
|
]
|
||||||
self.comments = {
|
self.comments = {
|
||||||
|
@ -393,6 +400,7 @@ CREATE TABLE public.dates AS (SELECT
|
||||||
'backoffice': u'soumission backoffce',
|
'backoffice': u'soumission backoffce',
|
||||||
'generic_status_id': u'statut simplifié',
|
'generic_status_id': u'statut simplifié',
|
||||||
'endpoint_delay': u'délai de traitement',
|
'endpoint_delay': u'délai de traitement',
|
||||||
|
'geolocation_base': u'position géographique',
|
||||||
}
|
}
|
||||||
self.create_table('{generic_formdata_table}', self.columns)
|
self.create_table('{generic_formdata_table}', self.columns)
|
||||||
for at, comment in self.comments.iteritems():
|
for at, comment in self.comments.iteritems():
|
||||||
|
@ -561,6 +569,8 @@ class WcsFormdefFeeder(object):
|
||||||
|
|
||||||
self.columns = ([name for name, _type in self.olap_feeder.columns]
|
self.columns = ([name for name, _type in self.olap_feeder.columns]
|
||||||
+ [name for name, _type in columns])
|
+ [name for name, _type in columns])
|
||||||
|
self.columns.remove('geolocation_base')
|
||||||
|
|
||||||
self.create_table('{formdata_table}', columns, inherits='{generic_formdata_table}',
|
self.create_table('{formdata_table}', columns, inherits='{generic_formdata_table}',
|
||||||
comment=u'formulaire %s' % self.formdef.schema.name)
|
comment=u'formulaire %s' % self.formdef.schema.name)
|
||||||
for at, comment in comments.iteritems():
|
for at, comment in comments.iteritems():
|
||||||
|
@ -589,7 +599,8 @@ class WcsFormdefFeeder(object):
|
||||||
['date', 'date'],
|
['date', 'date'],
|
||||||
['hour_id', 'smallint REFERENCES {hour_table} (id)'],
|
['hour_id', 'smallint REFERENCES {hour_table} (id)'],
|
||||||
])
|
])
|
||||||
self.ex('COMMENT ON TABLE {evolution_table} IS %s', vars=(u'evolution des demandes %s' % self.formdef.schema.name,))
|
self.ex('COMMENT ON TABLE {evolution_table} IS %s',
|
||||||
|
vars=(u'evolution des demandes %s' % self.formdef.schema.name,))
|
||||||
|
|
||||||
def insert_item_value(self, field, value):
|
def insert_item_value(self, field, value):
|
||||||
table_name = self.hash_table_name('{formdata_table}_field_%s' % field.varname)
|
table_name = self.hash_table_name('{formdata_table}_field_%s' % field.varname)
|
||||||
|
|
Loading…
Reference in New Issue