Skip to content

Commit

Permalink
Replace mph.json file with country-coder implementation (re: #6941)
Browse files Browse the repository at this point in the history
  • Loading branch information
quincylvania committed Nov 8, 2019
1 parent 271a4cb commit e8e95c6
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 9 deletions.
1 change: 0 additions & 1 deletion data/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export { dataShortcuts } from './shortcuts.json';
export { dataTerritoryLanguages } from './territory-languages.json';

export { default as dataImperial } from './imperial.json';
export { default as dataMPH } from './mph.json';
export { default as dataDriveLeft } from './drive-left.json';
export { en as dataEn } from '../dist/locales/en.json';

Expand Down
1 change: 0 additions & 1 deletion data/mph.json

This file was deleted.

9 changes: 2 additions & 7 deletions modules/ui/fields/maxspeed.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { dispatch as d3_dispatch } from 'd3-dispatch';
import { select as d3_select } from 'd3-selection';
import * as countryCoder from 'country-coder';

import { dataMPH } from '../../../data';
import { geoPointInPolygon } from '../../geo';
import { uiCombobox } from '../combobox';
import { utilGetSetValue, utilNoAuto, utilRebind } from '../../util';

Expand Down Expand Up @@ -57,11 +56,7 @@ export function uiFieldMaxspeed(field, context) {
loc = childNodes[~~(childNodes.length/2)].loc;
}

_isImperial = dataMPH.features.some(function(f) {
return f.geometry.coordinates.some(function(d) {
return geoPointInPolygon(loc, d);
});
});
_isImperial = countryCoder.roadSpeedUnit(loc) === 'mph';

unitInput = wrap.selectAll('input.maxspeed-unit')
.data([0]);
Expand Down

0 comments on commit e8e95c6

Please sign in to comment.