pelias-openstreetmap 5.13.1 → 5.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/config/features.js
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
// default tags imported
|
|
8
8
|
const tags = [
|
|
9
|
-
'addr:housenumber+addr:street'
|
|
9
|
+
'addr:housenumber+addr:street',
|
|
10
|
+
'addr:housenumber+addr:place' // @ref https://github.com/pelias/pelias/issues/787#issuecomment-477137803
|
|
10
11
|
];
|
|
11
12
|
|
|
12
13
|
// tags corresponding to venues
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pelias-openstreetmap",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.16.0",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=10.0.0"
|
|
6
6
|
},
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
"pelias-config": "^4.12.0",
|
|
47
47
|
"pelias-dbclient": "^2.13.0",
|
|
48
48
|
"pelias-logger": "^1.2.1",
|
|
49
|
-
"pelias-model": "^9.
|
|
50
|
-
"pelias-wof-admin-lookup": "^7.
|
|
49
|
+
"pelias-model": "^9.2.0",
|
|
50
|
+
"pelias-wof-admin-lookup": "^7.7.0",
|
|
51
51
|
"through2": "^3.0.0",
|
|
52
52
|
"through2-sink": "^1.0.0"
|
|
53
53
|
},
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
This stream is responsible for filling 'addr:street' if is empty or missing,
|
|
4
|
+
with 'addr:place' value. Note that both 'addr:place' and 'addr:housenumber'
|
|
5
|
+
must be present inside tags!
|
|
6
|
+
|
|
7
|
+
@ref https://github.com/pelias/openstreetmap/pull/565
|
|
8
|
+
**/
|
|
9
|
+
|
|
10
|
+
const _ = require('lodash');
|
|
11
|
+
const through = require('through2');
|
|
12
|
+
const peliasLogger = require('pelias-logger').get('openstreetmap');
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
module.exports = function(){
|
|
16
|
+
|
|
17
|
+
var stream = through.obj( function( doc, enc, next ) {
|
|
18
|
+
|
|
19
|
+
try {
|
|
20
|
+
|
|
21
|
+
// skip records with no tags
|
|
22
|
+
var tags = doc.getMeta('tags');
|
|
23
|
+
if( !tags ){
|
|
24
|
+
return next( null, doc );
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// housenumber is required
|
|
28
|
+
if (!_.has(tags, 'addr:housenumber')){
|
|
29
|
+
return next( null, doc );
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const street = _.get(tags, 'addr:street', '').trim();
|
|
33
|
+
const place = _.get(tags, 'addr:place', '').trim();
|
|
34
|
+
|
|
35
|
+
// when street is unset but place is set, use place for the street name
|
|
36
|
+
if (_.isEmpty(street) && !_.isEmpty(place)) {
|
|
37
|
+
_.set(tags, 'addr:street', place);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
catch( e ){
|
|
42
|
+
peliasLogger.error( 'addresses_without_street error' );
|
|
43
|
+
peliasLogger.error( e.stack );
|
|
44
|
+
peliasLogger.error( JSON.stringify( doc, null, 2 ) );
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return next( null, doc );
|
|
48
|
+
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// catch stream errors
|
|
52
|
+
stream.on( 'error', peliasLogger.error.bind( peliasLogger, __filename ) );
|
|
53
|
+
|
|
54
|
+
return stream;
|
|
55
|
+
};
|
package/stream/importPipeline.js
CHANGED
|
@@ -10,6 +10,7 @@ streams.pbfParser = require('./multiple_pbfs').create;
|
|
|
10
10
|
streams.docConstructor = require('./document_constructor');
|
|
11
11
|
streams.blacklistStream = require('pelias-blacklist-stream');
|
|
12
12
|
streams.tagMapper = require('./tag_mapper');
|
|
13
|
+
streams.addressesWithoutStreet = require('./addresses_without_street');
|
|
13
14
|
streams.adminLookup = require('pelias-wof-admin-lookup').create;
|
|
14
15
|
streams.addressExtractor = require('./address_extractor');
|
|
15
16
|
streams.categoryMapper = require('./category_mapper');
|
|
@@ -22,6 +23,7 @@ streams.elasticsearch = require('pelias-dbclient');
|
|
|
22
23
|
streams.import = function(){
|
|
23
24
|
streams.pbfParser()
|
|
24
25
|
.pipe( streams.docConstructor() )
|
|
26
|
+
.pipe( streams.addressesWithoutStreet() )
|
|
25
27
|
.pipe( streams.tagMapper() )
|
|
26
28
|
.pipe( streams.addressExtractor() )
|
|
27
29
|
.pipe( streams.blacklistStream() )
|