diff --git a/packages/map/src/components/UsaMap/components/UsaMap.SingleState.tsx b/packages/map/src/components/UsaMap/components/UsaMap.SingleState.tsx index 397cf2d93..fd7ff3a44 100644 --- a/packages/map/src/components/UsaMap/components/UsaMap.SingleState.tsx +++ b/packages/map/src/components/UsaMap/components/UsaMap.SingleState.tsx @@ -77,17 +77,6 @@ const SingleStateMap = props => { const checkForNoData = () => { // If no statePicked, return true if (!state.general.statePicked.fipsCode) return true - // if statePicked for District of Columbia, Guam, Puerto Rico, Virgin Islands, American Samoa, Northern Mariana Islands - if ( - state.general.statePicked.fipsCode === '11' || // District of Columbia - state.general.statePicked.fipsCode === '66' || // Guam - state.general.statePicked.fipsCode === '72' || // Puerto Rico - state.general.statePicked.fipsCode === '78' || // Virgin Islands - state.general.statePicked.fipsCode === '60' || // American Samoa - state.general.statePicked.fipsCode === '69' // Northern Mariana Islands - ) { - return true - } } // Constructs and displays markup for all geos on the map (except territories right now) diff --git a/packages/map/src/components/UsaMap/data/us-extended-geography.json b/packages/map/src/components/UsaMap/data/us-extended-geography.json new file mode 100644 index 000000000..08866789d --- /dev/null +++ b/packages/map/src/components/UsaMap/data/us-extended-geography.json @@ -0,0 +1 @@ +{"type":"Topology","arcs":[[[128628,58684],[30,57],[-17,63],[30,47],[44,-21],[35,35],[74,5],[26,-46],[170,8],[9,-28],[-140,-76],[-178,-47],[-83,3]],[[1608,280],[113,17],[5,-80],[-39,13],[-35,-44],[-44,94]],[[1408,384],[91,12],[-17,-33],[-57,-19],[-17,40]],[[122,156],[48,-77]],[[170,79],[-65,-79],[-48,74],[-57,25],[57,55],[65,2]],[[128706,59939],[0,-30]],[[128706,59909],[26,-69],[-69,-17],[-66,36],[-30,-32],[-52,78],[-105,-23],[30,85],[44,-36],[52,41],[83,-33],[87,0]],[[384328,54018],[17,44],[9,159],[39,-19],[87,105],[22,-34],[-61,-126],[17,-99],[-56,11],[0,-115],[-53,28],[-21,46]],[[128759,59886],[56,61],[48,-6],[66,-44],[-57,-7],[4,-77],[-39,32],[-57,-8],[-21,49]],[[128706,59939],[57,10],[-9,-37],[-48,-3]],[[383033,50942],[22,23],[148,25],[92,216],[26,102],[30,-17],[31,-68],[61,-17],[-44,-139],[-139,-171],[-39,-69],[-9,-175],[-52,-88],[-79,47],[-30,159],[35,79],[-53,93]],[[384201,53806],[18,70],[56,85],[22,-85],[-17,-37],[30,-63],[-9,-96],[-39,-46],[-61,172]],[[384746,55614],[44,68],[17,-25],[-35,-71],[-26,28]],[[384485,58543],[21,31],[5,-77],[-26,46]],[[384354,59393],[61,84],[0,93],[48,0],[0,-104],[-40,-21],[-43,-86],[-26,34]],[[384267,60694],[26,61],[48,-44],[-5,-80],[-35,-36],[-30,39],[-4,60]],[[384262,56279],[87,4],[13,-57],[-82,-13],[-18,66]],[[122,156],[87,108],[18,-31],[117,3],[18,-69],[-31,20],[-126,-47],[-35,-61]],[[383639,52173],[48,80],[92,55],[65,-14],[-9,-55],[-52,-20],[-35,-62],[-48,-9],[-22,36],[-39,-11]],[[113802,97593],[91,110],[48,-53],[113,-133],[-156,-185],[-5,88],[5,58],[-96,115]],[[126645,59224],[-48,-26],[-61,38],[-52,-30],[-31,21],[-74,37],[-96,-88],[-17,10],[-9,-2],[-65,-12],[-18,-38],[-65,47],[-4,27],[-92,12],[-61,-52],[-70,32],[-52,-19],[4,83],[44,49],[-48,19],[13,102],[22,24],[4,118],[31,49],[-40,132],[-47,55],[-57,119],[39,24],[96,74],[-9,115],[31,50],[48,16],[100,-7],[78,-39],[66,-9],[78,6],[87,-6],[70,-22],[105,40],[43,-17],[66,-6],[78,-24],[35,32],[109,0],[43,-21],[53,10],[87,-25],[48,-24],[39,35],[109,-41],[57,14],[104,-13],[92,-50],[43,-2],[53,-69],[100,-39],[52,44],[-9,-72],[14,-109],[56,-71],[-30,-67],[-48,29],[13,-44],[-39,4],[-35,-51],[-35,21],[-26,-32],[-44,-80],[-26,-110],[-39,-30],[-26,-75],[-74,-57],[-79,-24],[-52,19],[-31,-42],[-30,20],[-105,-67],[-43,14],[-31,-40],[-30,-3],[-27,57],[-91,58],[-57,-69],[-78,82],[-48,12],[-61,-26]],[[128105,59906],[48,-33],[6,2],[46,18],[39,-56],[-74,-57],[-11,7],[-41,23],[-13,96]],[[124954,59472],[87,19],[22,-68],[-65,-60],[-53,51],[9,58]],[[127817,59480],[214,85],[152,-51],[-78,-40],[-92,-11],[-48,-38],[-34,19],[-75,-27],[-39,63]],[[127795,59986],[31,-22],[0,-69],[-31,91]]],"transform":{"scale":[0.000823601132486181,0.000546229125192084],"translate":[-170.84530299432993,-14.373864584355845]},"objects":{"counties":{"type":"GeometryCollection","geometries":[{"arcs":[[[1]],[[2]]],"type":"MultiPolygon","properties":{"name":"Manu'a"},"id":"60020"},{"arcs":[[3,4]],"type":"Polygon","properties":{"name":"Western"},"id":"60050"},{"arcs":[[5,6]],"type":"Polygon","properties":{"name":"St. Thomas"},"id":"78030"},{"arcs":[[7]],"type":"Polygon","properties":{"name":"Saipan"},"id":"69110"},{"arcs":[[[8]],[[9,-6]]],"type":"MultiPolygon","properties":{"name":"St. John"},"id":"78020"},{"arcs":[[10]],"type":"Polygon","properties":{"name":"Guam"},"id":"66010"},{"arcs":[[11]],"type":"Polygon","properties":{"name":"Tinian"},"id":"69120"},{"arcs":[[[12]],[[13]],[[14]],[[15]],[[16]]],"type":"MultiPolygon","properties":{"name":"Northern Islands"},"id":"69085"},{"arcs":[[-4,17]],"type":"Polygon","properties":{"name":"Eastern"},"id":"60010"},{"arcs":[[18]],"type":"Polygon","properties":{"name":"Rota"},"id":"69100"},{"arcs":[[0]],"type":"Polygon","properties":{"name":"St. Croix"},"id":"78010"},{"arcs":[[0]],"type":"Polygon","properties":{"name":"District of Columbia"},"id":"11"}]},"states":{"type":"GeometryCollection","geometries":[{"arcs":[[[20]],[[21]],[[22]],[[23]],[[24]]],"type":"MultiPolygon","properties":{"name":"Puerto Rico"},"id":"72"},{"arcs":[[[1]],[[2]],[[4,17]]],"type":"MultiPolygon","properties":{"name":"American Samoa"},"id":"60"},{"arcs":[[[6,9]],[[0]],[[8]]],"type":"MultiPolygon","properties":{"name":"United States Virgin Islands"},"id":"78"},{"arcs":[[[7]],[[11]],[[12]],[[13]],[[14]],[[15]],[[16]],[[18]]],"type":"MultiPolygon","properties":{"name":"Commonwealth of the Northern Mariana Islands"},"id":"69"},{"arcs":[[10]],"type":"Polygon","properties":{"name":"Guam"},"id":"66"}]}}} \ No newline at end of file diff --git a/packages/map/src/components/UsaMap/helpers/map.ts b/packages/map/src/components/UsaMap/helpers/map.ts index edfdbdf08..fe49312ab 100644 --- a/packages/map/src/components/UsaMap/helpers/map.ts +++ b/packages/map/src/components/UsaMap/helpers/map.ts @@ -1,4 +1,5 @@ -import { feature, mesh } from 'topojson-client' +import { feature } from 'topojson-client' +import usExtendedGeography from './../data/us-extended-geography.json' export const getCountyTopoURL = year => { return `https://www.cdc.gov/TemplatePackage/contrib/data/county-topography/cb_${year}_us_county_20m.json` @@ -12,12 +13,16 @@ export const getTopoData = year => { } else { response = await response.json() } - let topoData = {} - topoData.year = year || 'default' - topoData.fulljson = response - topoData.counties = feature(response, response.objects.counties).features - topoData.states = feature(response, response.objects.states).features + const counties = [response, usExtendedGeography].flatMap(topo => feature(topo, topo.objects.counties).features) + const states = [response, usExtendedGeography].flatMap(topo => feature(topo, topo.objects.states).features) + + const topoData = { + year: year || 'default', + fulljson: response, + counties, + states + } resolve(topoData) } diff --git a/packages/map/src/data/supported-geos.js b/packages/map/src/data/supported-geos.js index 43bae02c2..31174463b 100644 --- a/packages/map/src/data/supported-geos.js +++ b/packages/map/src/data/supported-geos.js @@ -190,6 +190,7 @@ export const supportedStatesFipsCodes = { '08': 'Colorado', '09': 'Connecticut', 10: 'Delaware', + 11: 'District of Columbia', 12: 'Florida', 13: 'Georgia', 15: 'Hawaii', @@ -234,9 +235,9 @@ export const supportedStatesFipsCodes = { 56: 'Wyoming', 60: 'American Samoa', 66: 'Guam', - 69: 'Northern Mariana Islands', + 69: 'Commonwealth of the Northern Mariana Islands', 72: 'Puerto Rico', - 78: 'Virgin Islands' + 78: 'United States Virgin Islands' } export const supportedCountries = { @@ -289,7 +290,12 @@ export const supportedCountries = { COL: ['Colombia'], COM: ['Comoros'], COG: ['Congo', 'Congo, Republic of the', 'Republic of the Congo'], - COD: ['Democratic Republic of the Congo', 'Congo, Democratic Republic of the', 'Congo, the Democratic Republic of the', 'Dem. Rep. Congo'], + COD: [ + 'Democratic Republic of the Congo', + 'Congo, Democratic Republic of the', + 'Congo, the Democratic Republic of the', + 'Dem. Rep. Congo' + ], COK: ['Cook Islands', 'Cook Is.', 'Cook Islands (New Zealand)'], CRI: ['Costa Rica'], CIV: ["Côte d'Ivoire"], @@ -382,7 +388,12 @@ export const supportedCountries = { MUS: ['Mauritius'], MYT: ['Mayotte', 'Mayotte (France)'], MEX: ['Mexico'], - FSM: ['Micronesia', 'Federated States of Micronesia', 'Micronesia (Federated States of)', 'Micronesia, Federated States of'], + FSM: [ + 'Micronesia', + 'Federated States of Micronesia', + 'Micronesia (Federated States of)', + 'Micronesia, Federated States of' + ], MDA: ['Moldova', 'Moldova, Republic of'], MCO: ['Monaco'], MNG: ['Mongolia'],