Verified Commit 938febfc authored by Michael Auer's avatar Michael Auer
Browse files

fixes horizontal contributionview writing to postgres

parent e93596b8
...@@ -381,7 +381,7 @@ export class PgFeatureType extends FeatureType { ...@@ -381,7 +381,7 @@ export class PgFeatureType extends FeatureType {
// create a column SET // create a column SET
let columns: string[] = (!!featureCollection.features[0].properties) ? Object.keys(featureCollection.features[0].properties) : []; let columns: string[] = (!!featureCollection.features[0].properties) ? Object.keys(featureCollection.features[0].properties) : [];
let columnsDef: Column[] = columns.sort(PgColumnTypes.columnOrderFn).slice().map(col => { let columnsDef: Column[] = columns.sort(PgColumnTypes.columnOrderFn).slice().map(col => {
return new this.pgp.helpers.Column({name:col, prop:`_${col.replace(/[-:]/g,'_')}`}); return new this.pgp.helpers.Column({name:col, prop:`_${col.replace(/[-:\/]/g,'_')}`});
}); });
let geomFromGeoJSONFn = (col: { value: any; }) => { let geomFromGeoJSONFn = (col: { value: any; }) => {
const geometry = col.value; const geometry = col.value;
...@@ -444,7 +444,7 @@ export class PgFeatureType extends FeatureType { ...@@ -444,7 +444,7 @@ export class PgFeatureType extends FeatureType {
let newProps: {[p:string]:any} = {}; let newProps: {[p:string]:any} = {};
//for horizontal timestamps column names can't start with a digit //for horizontal timestamps column names can't start with a digit
for (const key in feature.properties) { for (const key in feature.properties) {
newProps[`_${key.replace(/[-:]/g,'_')}`] = feature.properties[key]; newProps[`_${key.replace(/[-:\/]/g,'_')}`] = feature.properties[key];
} }
return {...newProps, geom: feature.geometry}; return {...newProps, geom: feature.geometry};
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment