Skip to content

Commit

Permalink
added some comments, removed others
Browse files Browse the repository at this point in the history
  • Loading branch information
trescube committed Sep 21, 2017
1 parent 7cae984 commit 23be0c5
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/components/extractFields.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ function getAbbreviation(properties) {
}

function getHierarchies(id, properties) {
// if there are no hierarchies but there's a placetype, synthesize a hierarchy
if (_.isEmpty(_.get(properties, 'wof:hierarchy')) && _.has(properties, 'wof:placetype')) {
const hierarchy = {};
hierarchy[properties['wof:placetype'] + '_id'] = id;
Expand All @@ -85,6 +86,7 @@ function getHierarchies(id, properties) {

}

// otherwise just return the hierarchies as-is
return _.defaultTo(properties['wof:hierarchy'], []);

}
Expand All @@ -108,11 +110,8 @@ module.exports.create = function map_fields_stream() {
population: getPopulation(json_object.properties),
popularity: json_object.properties['misc:photo_sum'],
hierarchies: getHierarchies(json_object.id, json_object.properties)
// hierarchies: _.get(json_object, 'properties.wof:hierarchy', [])
};

// console.error(record.hierarchies);

// use the QS altname if US county and available
if (isUsCounty(record, json_object.properties['wof:country'], json_object.properties['qs:a2_alt'])) {
record.name = json_object.properties['qs:a2_alt'];
Expand Down

0 comments on commit 23be0c5

Please sign in to comment.