Commit 4078f65d authored by Michael Auer's avatar Michael Auer
Browse files

removed keys, values and types in favor of filter param of the new ohsome-api v1

parent 6d31df08
......@@ -307,35 +307,17 @@ let configureOhsomeQuery = async () => {
type: 'list',
name: 'queryType',
choices: [
{name: 'elements/count/groupBy/boundary', value: 'elements/count'},
{name: 'elements/length/groupBy/boundary', value: 'elements/length'},
{name: 'elements/area/groupBy/boundary', value: 'elements/area'},
{name: 'elements/perimeter/groupBy/boundary', value: 'elements/perimeter'},
{name: 'users/count/groupBy/boundary', value: 'users/count'}
{name: 'elements/count/groupBy/boundary'},
{name: 'elements/length/groupBy/boundary'},
{name: 'elements/area/groupBy/boundary'},
{name: 'elements/perimeter/groupBy/boundary'},
{name: 'users/count/groupBy/boundary'}
],
deafult: 'elements/count'
default: 'elements/count/groupBy/boundary'
},
{name: 'keys'},
{name: 'values'},
{
type: 'list',
name: 'types',
choices: [
'node',
'way',
'relation',
'way,relation',
'node,way',
'node,relation',
'node,way,relation',
'point',
'line',
'polygon',
'point,line',
'point,polygon',
'line,polygon',
'point,line,polygon'
]
name: 'filter',
message: 'Specify an ohsome-api filter text (e.g. building=* and building!=no and geometry:polygon):\n More info on syntax: https://docs.ohsome.org/ohsome-api/ \n>'
},
{
name: 'time',
......
......@@ -153,7 +153,7 @@ class Ohsome2X {
this.isContributionView = this.checkIsContributionView(ohsomeResults.data);
console.log('Start conversion ohsomeJSON to GeoJSON');
console.log('Start conversion ohsome-result to GeoJSON');
console.time('convert');
if (shouldCreateGeometry) {
if (typeof ohsomeResults.data == 'string') {
......@@ -193,7 +193,7 @@ class Ohsome2X {
console.timeEnd('computeValuePerArea');
await this.targetFeatureType.writeFeatures(targetFeatureCollection);
//await this.targetFeatureType.writeOhsomeFeatures(ohsomeResults.data, false);
console.log('-----------------------------------------' + Date.now() + '-----------------------------------------');
}
} catch (e) {
......@@ -350,12 +350,9 @@ class Ohsome2X {
async getOhsomeResults(ohsomeQuery: OhsomeQueryConfig): Promise<AxiosResponse> {
// set empty strings to null
const keys = (ohsomeQuery.keys != null && ohsomeQuery.keys.trim() != '')? ohsomeQuery.keys.trim() : undefined;
const values = (ohsomeQuery.values != null && ohsomeQuery.values.trim() != '')? ohsomeQuery.values.trim() : undefined;
const filter = (ohsomeQuery.filter != null && ohsomeQuery.filter.trim() != '')? ohsomeQuery.filter.trim() : undefined;
const format: OhsomeQueryConfigFormat = (ohsomeQuery.format != null && ohsomeQuery.format.trim() != '')? ohsomeQuery.format.trim() as 'csv'|'json' : undefined;
try {
if (ohsomeQuery.bpolys == null) {
......@@ -366,10 +363,8 @@ class Ohsome2X {
//default query object, empty values will be removed due to issue with ohsomeAPI: https://gitlab.gistools.geog.uni-heidelberg.de/giscience/big-data/ohsome/ohsome-api/issues/72
let dataObject: {} = {
bpolys: bpolyString,
keys: keys,
values: values,
filter: filter,
time: ohsomeQuery.time,
types: ohsomeQuery.types,
showMetadata: true,
format: format
}
......
......@@ -54,12 +54,7 @@ export class PgFeatureType extends FeatureType {
return parseInt(val)
});
this.db = new PgAsync(this.store);
this.runCheckTableExists();
//this.tableExists = config.exists;
}
async runCheckTableExists() {
this.tableExists = await this.checkTableExists();
this.checkTableExists();
}
async checkTableExists() {
......@@ -72,12 +67,11 @@ export class PgFeatureType extends FeatureType {
AND (c.relkind = 'r' OR c.relkind = 'v' ) -- only tables or views
);`;
//return await this.db.value(sql);
let exists;
try {
exists = await this.db.value(sql);
console.log(`Checked if TABLE ${this.schemaName}.${this.tableName} exists: ${exists}`);
this.tableExists = exists;
return exists;
} catch (e) {
console.log(e);
......
const defaultConfig = {
OHSOME_API_URL : 'https://api.ohsome.org/v0.9'
OHSOME_API_URL : 'https://api.ohsome.org/v1'
};
export default defaultConfig;
......
......@@ -48,8 +48,6 @@ export interface PostgisFeatureTypeConfig extends FeatureTypeConfig<PostgisStore
geometryColumn: string;
}
export interface SourceGeoJSONFeatureTypeConfig extends GeoJSONFeatureTypeConfig, SourceFeatureTypeConfig {}
export interface SourcePostgisFeatureTypeConfig extends PostgisFeatureTypeConfig, SourceFeatureTypeConfig {
fetchSize?: number; // default is 0 ( -> compute all in one )
......@@ -60,16 +58,11 @@ export interface TargetPostgisFeatureTypeConfig extends PostgisFeatureTypeConfig
createIndexes?: boolean;
}
export type OhsomeQueryConfigTypes = 'node' | 'way' | 'relation' | 'node,way' | 'node,relation' | 'way,relation' | 'node,way,relation' | 'point' | 'line' | 'polygon' | 'point,line' | 'point,polygon' | 'line,polygon' | 'point,line,polygon' | '';
export type OhsomeQueryConfigFormat = 'json' | 'csv' | undefined;
export interface OhsomeQueryConfig {
queryType: string; // e.g. elements/count for elements/count/groupBy/boundary
keys?: string; // comma seperated values e.g.['highway','maxspeed'].join(),
values?: string; // comma seperated values e.g. ['','50'].join(),
types: OhsomeQueryConfigTypes;
filter?: string // new ohsome-api filter format see: https://docs.ohsome.org/ohsome-api/
time: string; // e.g. ISO8601 start/end/interval_period '2015-01-01/2017-01-01/P1Y'
bpolys?: FeatureCollection | string;
bboxes?: string;
......
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