Skip to content

Commit

Permalink
Merge pull request #338 from pelias/joxit/fix-code-to-layer-fr
Browse files Browse the repository at this point in the history
fix(featureCodeToLayerFR): Better layer mapping for France
  • Loading branch information
orangejulius authored Oct 4, 2018
2 parents 0e331bd + 8550bca commit 2372756
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
10 changes: 9 additions & 1 deletion lib/streams/layerMappingStream.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,16 @@ function featureCodeToLayerES(featureCode) {

function featureCodeToLayerFR(featureCode) {
switch (featureCode) {
case 'RGN':
case 'ADM1':
return 'macroregion';
case 'ADM2':
return 'region';
case 'ADM3':
return 'macrocounty';
case 'ADM4':
return 'locality';
case 'LCTY':
return 'venue';
default:
return featureCodeToLayerDefault(featureCode);
}
Expand Down
24 changes: 22 additions & 2 deletions test/streams/layerMappingStreamTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,28 @@ tape('country specific featureCodes', function(test) {
t.end();
});

test.test('RGN in FR maps to macroregion', function(t) {
t.equal(featureCodeToLayer('RGN', 'FR'), 'macroregion', 'Geonames RGN maps to macroregion in France');
test.test('ADM1 in FR maps to macroregion', function(t) {
t.equal(featureCodeToLayer('ADM1', 'FR'), 'macroregion', 'Geonames ADM1 maps to macroregion in France');
t.end();
});

test.test('ADM2 in FR maps to region', function(t) {
t.equal(featureCodeToLayer('ADM2', 'FR'), 'region', 'Geonames ADM2 maps to region in France');
t.end();
});

test.test('ADM3 in FR maps to macrocounty', function(t) {
t.equal(featureCodeToLayer('ADM3', 'FR'), 'macrocounty', 'Geonames ADM3 maps to macrocounty in France');
t.end();
});

test.test('ADM4 in FR maps to locality', function(t) {
t.equal(featureCodeToLayer('ADM4', 'FR'), 'locality', 'Geonames ADM4 maps to locality in France');
t.end();
});

test.test('LCTY in FR maps to venue', function(t) {
t.equal(featureCodeToLayer('LCTY', 'FR'), 'venue', 'Geonames LCTY maps to venue in France');
t.end();
});

Expand Down

0 comments on commit 2372756

Please sign in to comment.