Commit 2bda6c96 authored by Tobias Steiner's avatar Tobias Steiner
Browse files

Encode as geohash

parent 8773d4c2
......@@ -1246,6 +1246,11 @@
"integrity": "sha1-GVoh1sRuNh0vsSgbo4uR6d9727M=",
"optional": true
},
"ngeohash": {
"version": "0.6.3",
"resolved": "https://registry.npmjs.org/ngeohash/-/ngeohash-0.6.3.tgz",
"integrity": "sha512-kltF0cOxgx1AbmVzKxYZaoB0aj7mOxZeHaerEtQV0YaqnkXNq26WWqMmJ6lTqShYxVRWZ/mwvvTrNeOwdslWiw=="
},
"nise": {
"version": "1.4.10",
"resolved": "https://registry.npmjs.org/nise/-/nise-1.4.10.tgz",
......
......@@ -4,6 +4,7 @@ import {Transform} from 'stream';
import {LoggerInstance} from 'winston';
import {BootstrapWikidata} from './bootstrap-wikidata';
import toDateObject from './wikidata_time_to_date_object';
import geohash from 'ngeohash';
class WikiNormalizer extends Transform {
/**
......@@ -66,7 +67,7 @@ class WikiNormalizer extends Transform {
end: this.getEnd(obj),
typology: this.getInstanceOf(obj),
modification_date: `${date.getFullYear()}-${date.getMonth()}-${date.getDate()}`,
location: `${lat},${lon}`,
location: geohash.encode(lat, lon, 9),
};
} catch (err) {
this.logger.error(`Transformer Error`);
......
Supports Markdown
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