Skip to content

Commit

Permalink
Merge branch 'rsimon:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
portableant committed Jul 13, 2022
2 parents 104cbb5 + 337734b commit bbbc526
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
4 changes: 2 additions & 2 deletions docs/peripleo-fitzwilliam.js

Large diffs are not rendered by default.

16 changes: 14 additions & 2 deletions harvest/scripts/src/crosswalk.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ const features = [];
const capitalize = str =>
str[0].toUpperCase() + str.slice(1).toLowerCase();

// Keep track, so we can geo-reference later
let allUnlocatedPlaces = [];

const crosswalkOne = (idx = 0) => {
console.log(`Crosswalking ${idx + 1}/${files.length}`);

Expand Down Expand Up @@ -50,8 +53,11 @@ const crosswalkOne = (idx = 0) => {

const locatedPlaces = places.filter(p => p.coordinates);

// TODO Peripleo only supports single place per record at the moment!
const unlocatedPlaces = places.filter(p => !p.coordinates).map(p => p.summary_title);
if (unlocatedPlaces.length > 0)
allUnlocatedPlaces = [...allUnlocatedPlaces, ...unlocatedPlaces];

// Note: Peripleo only supports single place per record at the moment!
if (locatedPlaces.length > 0) {
const { coordinates } = locatedPlaces[0];

Expand Down Expand Up @@ -99,7 +105,13 @@ const crosswalkOne = (idx = 0) => {
};

fs.writeFileSync('../../public/data/crosswalked.json', JSON.stringify(geojson, null, 2));
console.log('Done.');

const uniqueUnlocated = Array.from(new Set(allUnlocatedPlaces)).sort();

const csv = uniqueUnlocated.map(str => `"${str.replaceAll('"', '\\"')}"`).join('\n');
fs.writeFileSync('./unlocated.csv', csv);

console.log(`Done. Recorded ${uniqueUnlocated.length} unlocated places.`);
}
}

Expand Down
1 change: 1 addition & 0 deletions src/store/loaders/LinkedPlacesLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const featureToNode = (feature, name) => {

// For convenience when mapping
node.properties.id = id;
node.properties.url = feature['@id'];
node.properties.dataset = name;

return node;
Expand Down

0 comments on commit bbbc526

Please sign in to comment.