Replace mph.json file with country-coder implementation (re: #6941)

This commit is contained in:
Quincy Morgan
2019-11-08 18:48:33 +01:00
parent 271a4cbac7
commit e8e95c69e6
3 changed files with 2 additions and 9 deletions
-1
View File
@@ -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';
-1
View File
File diff suppressed because one or more lines are too long
+2 -7
View File
@@ -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';
@@ -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]);