Skip to content

Commit

Permalink
Fix how the Google Open Buildings data_used tag gets assigned
Browse files Browse the repository at this point in the history
(re #1300)

There are actually two places that this happens,
and the old code only had it in one place.

I moved the function into the Esri service.
  • Loading branch information
bhousel committed Nov 27, 2024
1 parent efa41b9 commit 2f5be0e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 23 deletions.
22 changes: 1 addition & 21 deletions modules/core/RapidSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,26 +294,6 @@ export class RapidSystem extends AbstractSystem {
}



/**
* _openBuildingsTitle
* For #1309 we need to change the dataset titles from
* 'Google Buildings for <Country>' to 'Google Open Buildings'.
*
* All other titles are returned unmodified.
*
* @param {*} title string for the dataset
* @return the same title in most cases, or the proper google buildings title if applicable.
*/
_openBuildingsTitle(title) {

if (title.startsWith('Google Buildings for')) {
return 'Google Open Buildings';
} else {
return title;
}
}

/**
* _hashchange
* Respond to any changes appearing in the url hash
Expand Down Expand Up @@ -376,7 +356,7 @@ export class RapidSystem extends AbstractSystem {
conflated: false,
service: 'esri',
color: RAPID_COLORS[nextColor],
dataUsed: ['esri', this._openBuildingsTitle(d.title)],
dataUsed: ['esri', esri.getDataUsed(d.title)],
label: d.title,
license_markdown: l10n.t('rapid_feature_toggle.esri.license_markdown'),
licenseStringID: 'rapid_feature_toggle.esri.license_markdown'
Expand Down
20 changes: 19 additions & 1 deletion modules/services/EsriService.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,24 @@ export class EsriService extends AbstractSystem {
}


/**
* getDataUsed
* This returns the string to use for the changeset `data_used` tag.
* For Rapid#1309 we need to change the "data used" string from
* 'Google Buildings for <Country>' to 'Google Open Buildings'.
* All other titles are returned unmodified.
* @param {string} title - the title to consider
* @return {string} The same title in most cases, or the proper google buildings title if applicable.
*/
getDataUsed(title) {
if (title.startsWith('Google Buildings for')) {
return 'Google Open Buildings';
} else {
return title;
}
}


/**
* loadTiles
* Schedule any data requests needed to cover the current map view
Expand Down Expand Up @@ -446,7 +464,7 @@ export class EsriService extends AbstractSystem {
}

// Since ESRI had to split the massive google open buildings dataset into multiple countries,
// They asked us to aggregate them all under the same 'Google Open Buildings' dataset - #1300
// They asked us to aggregate them all under the same 'Google Open Buildings' dataset - Rapid#1300
let name = `${dataset.name}`;
if (name.startsWith('Google_Buildings_for')) {
name = 'Google_Open_Buildings';
Expand Down
2 changes: 1 addition & 1 deletion modules/ui/rapid_view_manage_datasets.js
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ export function uiRapidViewManageDatasets(context, parentModal) {
conflated: false,
service: 'esri',
color: colors[colorIndex],
dataUsed: ['esri', d.title],
dataUsed: ['esri', esri.getDataUsed(d.title)],
label: d.title,
license_markdown: l10n.t('rapid_feature_toggle.esri.license_markdown'),
licenseStringID: 'rapid_feature_toggle.esri.license_markdown'
Expand Down

0 comments on commit 2f5be0e

Please sign in to comment.