Browse Source

interpolation: fix: source_id mapping

pull/769/head
missinglink 8 years ago
parent
commit
3a4d26077a
  1. 5
      middleware/interpolate.js
  2. 6
      test/unit/middleware/interpolate.js

5
middleware/interpolate.js

@ -105,8 +105,9 @@ function interpolate( parsed_text, hit, cb ){
// -- source_id --
// note: interpolated values have no source_id
if( hit.hasOwnProperty( 'source_id' ) ){
hit.source_id = hit.source_id;
delete hit.source_id; // remove original street source_id
if( data.properties.hasOwnProperty( 'source_id' ) ){
hit.source_id = data.properties.source_id;
}
// -- address_parts --

6
test/unit/middleware/interpolate.js

@ -149,7 +149,8 @@ module.exports.tests.hit = function(test, common) {
layer: 'street',
center_point: { lat: 1, lon: 1 },
address_parts: { street: 'sesame rd' },
name: { default: 'street name' }
name: { default: 'street name' },
source_id: '123456'
}
]};
@ -180,7 +181,8 @@ module.exports.tests.hit = function(test, common) {
center_point: { lat: 22.2, lon: -33.3 },
address_parts: { street: 'sesame rd', number: '100A' },
name: { default: '100A street name' },
source: 'openstreetmap'
source: 'openstreetmap',
source_id: 'way:111111'
}
]});
t.end();

Loading…
Cancel
Save