Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unfpa population tile #4254

Merged
merged 2 commits into from
Nov 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
'use strict';

import { updateValues } from '../utilities';

var dbm;
var type;
var seed;

/**
* We receive the dbmigrate dependency from dbmigrate initially.
* This enables us to not have to rely on NODE_PATH.
*/
exports.setup = function (options, seedLink) {
dbm = options.dbmigrate;
type = dbm.dataType;
seed = seedLink;
};

const projectCode = 'unfpa';
const previousConfig = {
permanentRegionLabels: true,
projectDashboardHeader: 'Regional',
};
const newConfig = {
tileSets: 'unfpaPopulation',
includeDefaultTileSets: true,
permanentRegionLabels: true,
projectDashboardHeader: 'Regional',
};

exports.up = async function (db) {
await updateValues(db, 'project', { config: newConfig }, { code: projectCode });
};

exports.down = async function (db) {
await updateValues(db, 'project', { config: previousConfig }, { code: projectCode });
};

exports._meta = {
version: 1,
};
11 changes: 11 additions & 0 deletions packages/web-frontend/src/constants/mapbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ const urls = {
laosEthnicity: makeMapboxStyleUrl({ styleId: 'ckm5nv5rv82j217qka0kylmsu' }),
laosTerrain: makeMapboxStyleUrl({ styleId: 'ckm5o375h43a017qym8ic3sgh' }),
laosPopulation: makeMapboxStyleUrl({ styleId: 'ckm5nolwx0pkt17o7vvgnuya0' }),
// UNFPA
unfpaPopulation: makeMapboxStyleUrl({ styleId: 'cl5w14no4001m14qyaermcomc' }),
};

const openStreets = key => ({
Expand Down Expand Up @@ -156,6 +158,13 @@ const population = key => ({
link: 'https://www.worldpop.org/geodata/listing?id=69',
},
});
const unfpaPopulation = key => ({
key,
label: 'Population per 1km',
thumbnail:
'https://tupaia.s3-ap-southeast-2.amazonaws.com/uploads/unfpa-population-tile-thumbnail.png',
url: urls[key],
});

export const TILE_SETS = [
openStreets('osm'),
Expand All @@ -173,4 +182,6 @@ export const TILE_SETS = [
ethnicity('laosEthnicity'),
terrain('laosTerrain'),
population('laosPopulation'),
// UNFPA
unfpaPopulation('unfpaPopulation'),
];