美文网首页
国家数据格式:数组对象匹配国家

国家数据格式:数组对象匹配国家

作者: 西瓜炒苦瓜 | 来源:发表于2019-12-25 16:31 被阅读0次

    <!DOCTYPE html>
    <html lang='en'>

    <head>
    <meta charset='UTF-8'>
    <meta name='viewport' content='width=device-width, initial-scale=1.0'>
    <meta http-equiv='X-UA-Compatible' content='ie=edge'>
    <title>Document</title>
    </head>

    <body>
    <script>
    let geoCoordMap = {
    'Afghanistan': [67.71, 33.94],
    'Aland Islands': [60.25, 20.00],
    'Albania': [20.17, 41.15],
    'Algeria': [1.66, 28.03],
    'American Samoa': [14.16, 170.42],
    'Andorra': [1.52, 42.51],
    'Angola': [17.87, -11.20],
    'Anguilla': [-63.07, 18.22],
    'Antarctica': [0, 66.5],
    'Antigua and Barbuda': [17.060816, -61.796429],
    'Argentina': [-63.62, -38.42],
    'Armenia': [45.04, 40.07],
    'Aruba': [12.521110, -69.968338],
    'Australia': [133.78, -25.27],
    'Austria': [14.55, 47.52],
    'Azerbaijan': [47.58, 40.14],
    'Bahamas': [-77.40, 25.03],
    'Bahrain': [50.56, 26.07],
    'Bangladesh': [90.36, 23.68],
    'Barbados': [-59.54, 13.19],
    'Belarus': [27.95, 53.71],
    'Belgium': [4.47, 50.50],
    'Belize': [-88.50, 17.19],
    'Benin': [2.32, 9.31],
    'Bermuda': [-64.75, 32.31],
    'Bhutan': [27.514162, 90.433601],
    'Bolivia': [-63.59, -16.29],
    'Bonaire': [12.201890, -68.262383],
    'Bosnia and Herzegovina': [43.915886, 17.679075],
    'Botswana': [24.68, -22.33],
    'Bouvet Island': [-54.420792, 3.346450],
    'Brazil': [-51.93, -14.24],
    'British Indian Ocean Territory': [-7.261620, 72.377769],
    'Brunei Darussalam': [4.535277, 114.727669],
    'Bulgaria': [25.49, 42.73],
    'Burkina Faso': [12.238333, -1.561593],
    'Burundi': [29.92, -3.37],
    'Cabo Verde': [14.916700, -23.507500],
    'Cambodia': [12.565679, 104.990967],
    'Cameroon': [12.35, 7.37],
    'Canada': [-106.35, 56.13],
    'Cayman Islands': [19.313299, -81.254601],
    'Central African Republic': [20.94, 6.61],
    'Chad': [18.73, 15.45],
    'Chile': [-71.54, -35.68],
    'China': [104.20, 35.86],
    'Christmas Island': [-10.447525, 105.690453],
    'Cocos (Keeling) Islands': [-12.140900, 96.823517],
    'Colombia': [-74.30, 4.57],
    'Comoros': [-11.645500, 43.333302],
    'Congo DP': [16.067160, 108.234570],
    'Congo': [15.83, -0.23],
    'Cook Islands': [-21.236736, -159.777664],
    'Costa Rica': [-83.75, 9.75],
    'Coted Ivoire':[5.349390,-4.017050],
    'Croatia': [15.2, 45.1],
    'Cuba': [-77.78, 21.52],
    'Curacao': [12.169570, -68.990021],
    'Cyprus': [33.43, 35.13],
    'Czechia': [12.841150, 15.530190],
    'Denmark': [9.50, 56.26],
    'Djibouti': [42.59, 11.83],
    'Dominica': [-0.19, 51.52],
    'Dominican Republic': [18.735693, -70.162651],
    'Ecuador': [-78.18, -1.83],
    'Egypt': [30.80, 26.82],
    'El Salvador': [13.794185, -88.896530],
    'Equatorial Guinea': [1.650801, 10.267895],
    'Eritrea': [15.339000, 38.937111],
    'Estonia': [25.01, 58.60],
    'Eswatini': [-25.472811, 28.051470],
    'Ethiopia': [40.49, 9.15],
    'Falkland Islands': [-51.796253, -59.523613],
    'Faroe Islands': [61.892635, -6.911806],
    'Fiji': [178.07, -17.71],
    'Finland': [25.75, 61.92],
    'France': [2.21, 46.23],
    'French Guiana': [-53.13, 3.93],
    'French Polynesia': [-149.41, -17.68],
    'French Southern Territories': [-43.904518, 63.881390],
    'Gabon': [11.61, -0.80],
    'Gambia': [-15.31, 13.44],
    'Georgia': [-82.90, 32.17],
    'Germany': [10.45, 51.17],
    'Ghana': [-1.02, 7.95],
    'Gibraltar': [-5.35, 36.14],
    'Greece': [21.82, 39.07],
    'Greenland': [71.706940, -42.604301],
    'Grenada': [-61.68, 12.12],
    'Guadeloupe': [16.264999, -61.550999],
    'Guam': [144.79, 13.44],
    'Guatemala': [-90.23, 15.78],
    'Guernsey': [49.43, 357.4],
    'Guinea': [-9.70, 9.95],
    'Guinea-Bissau': [11.52, 15.39],
    'Guyana': [-58.93, 4.86],
    'Haiti': [-72.29, 18.97],
    'Heard Island and McDonald Islands': [],
    'Holy See': [],
    'Honduras': [-86.24, 15.20],
    'Hong Kong': [114.11, 22.40],
    'Hungary': [19.50, 47.16],
    'Iceland': [-19.02, 64.96],
    'India': [78.96, 20.59],
    'Indonesia': [113.92, -0.79],
    'Iran IR': [51.0365971, 35.6754346],
    'Iraq': [43.68, 33.22],
    'Ireland': [-8.24, 53.41],
    'Isle of Man': [54.09, 4.28],
    'Israel': [34.85, 31.05],
    'Italy': [12.57, 41.87],
    'Jamaica': [-77.30, 18.11],
    'Japan': [138.25, 36.20],
    'Jersey': [-2.1312500000000227, 49.214439],
    'Jordan': [36.24, 30.59],
    'Kazakhstan': [43.19, 76.55],
    'Kenya': [37.91, -0.02],
    'Kiribati': [1.25, 172.54],
    'Korea DPR': [37.35, 127.03],
    'Korea': [127.98, 37.66],
    'Kuwait': [47.48, 29.31],
    'Kyrgyzstan': [74.77, 41.20],
    'Lao Peoples Democratic Republic':[],
    'Latvia': [24.60, 56.88],
    'Lebanon': [35.86, 33.85],
    'Lesotho': [28.23, -29.61],
    'Liberia': [-9.43, 6.43],
    'Libya': [17.23, 26.34],
    'Liechtenstein': [9.56, 47.17],
    'Lithuania': [23.88, 55.17],
    'Luxembourg': [6.13, 49.82],
    'Macao': [113.54, 22.20],
    'Madagascar': [46.87, -18.77],
    'Malawi': [34.30, -13.25],
    'Malaysia': [101.98, 4.21],
    'Maldives': [73.54, 1.98],
    'Mali': [-4.00, 17.57],
    'Malta': [14.38, 35.94],
    'Marshall Islands': [171.184478, 7.131474],
    'Martinique': [-61.02, 14.64],
    'Mauritania': [-10.940834999999993, 21.00789],
    'Mauritius': [57.55, -20.35],
    'Mayotte': [12.47, 45.14],
    'Mexico': [-102.55, 23.63],
    'Micronesia': [158.21507169999995, 6.8873508],
    'Moldova': [47.01, 28.50],
    'Monaco': [7.42, 43.74],
    'Mongolia': [103.85, 46.86],
    'Montenegro': [42.75, 19.25],
    'Montserrat': [-62.19, 16.74],
    'Morocco': [-7.09, 31.79],
    'Mozambique': [35.53, -18.67],
    'Myanmar': [16.47, 96.10],
    'Namibia': [18.49, -22.96],
    'Nauru': [166.93, -0.52],
    'Nepal': [84.12, 28.39],
    'Netherlands': [5.29, 52.13],
    'New Caledonia': [22.1635, 166.2725],
    'New Zealand': [174.89, -40.90],
    'Nicaragua': [-85.21, 12.87],
    'Niger': [8.08, 17.61],
    'Nigeria': [8.68, 9.08],
    'Niue': [-169.867233, -19.054445],
    'Norfolk Island': [29.03, 167.58],
    'North Macedonia': [21.745274999999992, 41.608635],
    'Northern Mariana Islands': [15.07, 145.27],
    'Norway': [8.47, 60.47],
    'Oman': [55.98, 21.47],
    'Pakistan': [69.35, 30.38],
    'Palau': [134.58251999999993, 7.514979999999999],
    'Palestine': [31.54, 35.12],
    'Panama': [-80.78, 8.54],
    'Papua New Guinea': [9.27, 147.11],
    'Paraguay': [-58.44, -23.44],
    'Peru': [-75.02, -9.19],
    'Philippines': [121.77, 12.88],
    'Pitcairn': [],
    'Poland': [19.15, 51.92],
    'Portugal': [-8.22, 39.40],
    'Puerto Rico': [-66.59, 18.22],
    'Qatar': [51.18, 25.35],
    'Réunion': [55.54, -21.12],
    'Romania': [24.97, 45.94],
    'Russian Federation': [37.37, 55.45],
    'Rwanda': [1.57, 30.03],
    'Saint Barthélemy': [],
    'Saint Helena': [15.55, 5.43],
    'Saint Kitts and Nevis': [17.18, 62.43],
    'Saint Lucia': [-60.97889299999997, 13.909444],
    'Saint Martin (French part)': [-76.82596519999998, -7.244488100000001],
    'Saint Pierre and Miquelon': [],
    'Saint Vincent and the Grenadines': [13.09, 61.13],
    'Samoa': [-121.83, 37.35],
    'San Marino': [12.46, 43.94],
    'Sao Tome and Principe': [6.61, 0.19],
    'Saudi Arabia': [45.08, 23.89],
    'Senegal': [-14.45, 14.50],
    'Serbia': [21.005858999999987, 44.016521],
    'Seychelles': [55.49, -4.68],
    'Sierra Leone': [-11.78, 8.46],
    'Singapore': [103.82, 1.35],
    'Sint Maarten (Dutch part)': [-76.82596519999998, -7.244488100000001],
    'Slovakia': [19.70, 48.67],
    'Slovenia': [15.00, 46.15],
    'Solomon Islands': [-6.89, 160.11],
    'Somalia': [46.19961599999999, 5.152149],
    'South Africa': [22.94, -30.56],
    'South Georgia and the South Sandwich Islands': [-36.58790899999997, -54.429579],
    'South Sudan': [4.51, 31.35],
    'Spain': [-3.75, 40.46],
    'Sri Lanka': [80.77, 7.87],
    'Sudan': [30.22, 12.86],
    'Suriname': [-56.03, 3.92],
    'Svalbard and Jan Mayen': [],
    'Sweden': [18.64, 60.13],
    'Switzerland': [8.23, 46.82],
    'Syrian Arab Republic': [36.18, 33.30],
    'Taiwan (Province of China)': [29.16, 88.51],
    'Tajikistan': [37.76, 73.46],
    'Tanzania': [34.89, -6.37],
    'Thailand': [100.99, 15.87],
    'Timor-Leste': [8.35, 125.35],
    'Togo': [0.82, 8.62],
    'Tokelau': [-9.17, -171.83],
    'Tonga': [-175.20, -21.18],
    'Trinidad and Tobago': [-61.22, 10.69],
    'Tunisia': [9.54, 33.89],
    'Turkey': [35.24, 38.96],
    'Turkmenistan': [59.56, 38.97],
    'Turks and Caicos Islands': [21.27, 71.08],
    'Tuvalu': [8.31, 179.13],
    'Uganda': [32.29, 1.37],
    'Ukraine': [31.17, 48.38],
    'United Arab Emirates': [53.85, 23.42],
    'United Kingdom of Great Britain and Northern Ireland': [],
    'United States Minor Outlying Islands': [28.2167, -177.36728,],
    'United States of America': [-95.71, 37.09],
    'Uruguay': [-55.77, -32.52],
    'Uzbekistan': [64.59, 41.38],
    'Vanuatu': [17.44, 168.19],
    'Venezuela': [-66.59, 6.42],
    'Viet Nam': [10.46, 106.43],
    'Virgin Islands (British)': [],
    'Virgin Islands (U.S.)': [],
    'Wallis and Futuna': [15.536, 178.1018],
    'Western Sahara': [35, 14],
    'Yemen': [48.52, 15.55],
    'Zambia': [27.85, -13.13],
    'Zimbabwe': [29.15, -19.02],
    }
    let clData = [
    {name: 'China', Device: '5', statusType: "Activated"},
    {name: 'Zimbabwe', Device: '6', statusType: "Activated"}
    ]
    let makeMapData = rawData => rawData.map(item => {
    item.value = geoCoordMap[item.name] || [];
    return item;
    });
    console.log(makeMapData(clData), '2222');

        // let rawData = [
        //     ['Afghanistan'],
        //     ['Aland Islands'],
        //     ['Albania'],
        //     ['Algeria'],
        //     ['American Samoa'],
        //     ['Andorra'],
        //     ['Angola'],
        //     ['Anguilla'],
        //     ['Antarctica'],
        //     ['Antigua and Barbuda'],
        //     ['Argentina'],
        //     ['Armenia'],
        //     ['Aruba'],
        //     ['Australia'],
        //     ['Austria'],
        //     ['Azerbaijan'],
        //     ['Bahamas'],
        //     ['Bahrain'],
        //     ['Bangladesh'],
        //     ['Barbados'],
        //     ['Belarus'],
        //     ['Belgium'],
        //     ['Belize'],
        //     ['Benin'],
        //     ['Bermuda'],
        //     ['Bhutan'],
        //     ['Bolivia'],
        //     ['Bonaire'],
        //     ['Bosnia and Herzegovina'],
        //     ['Botswana'],
        //     ['Bouvet Island'],
        //     ['Brazil'],
        //     ['British Indian Ocean Territory'],
        //     ['Brunei Darussalam'],
        //     ['Bulgaria'],
        //     ['Burkina Faso'],
        //     ['Burundi'],
        //     ['Cabo Verde'],
        //     ['Cambodia'],
        //     ['Cameroon'],
        //     ['Canada'],
        //     ['Cayman Islands'],
        //     ['Central African Republic'],
        //     ['Chad'],
        //     ['Chile'],
        //     ['China'],
        //     ['Christmas Island'],
        //     ['Cocos (Keeling) Islands'],
        //     ['Colombia'],
        //     ['Comoros'],
        //     ['Congo DP'],
        //     ['Congo'],
        //     ['Cook Islands'],
        //     ['Costa Rica'],
        //     ['Coted Ivoire'],
        //     ['Croatia'],
        //     ['Cuba'],
        //     ['Curacao'],
        //     ['Cyprus'],
        //     ['Czechia'],
        //     ['Denmark'],
        //     ['Djibouti'],
        //     ['Dominica'],
        //     ['Dominican Republic'],
        //     ['Ecuador'],
        //     ['Egypt'],
        //     ['El Salvador'],
        //     ['Equatorial Guinea'],
        //     ['Eritrea'],
        //     ['Estonia'],
        //     ['Eswatini'],
        //     ['Ethiopia'],
        //     ['Falkland Islands'],
        //     ['Faroe Islands'],
        //     ['Fiji'],
        //     ['Finland'],
        //     ['France'],
        //     ['French Guiana'],
        //     ['French Polynesia'],
        //     ['French Southern Territories'],
        //     ['Gabon'],
        //     ['Gambia'],
        //     ['Georgia'],
        //     ['Germany'],
        //     ['Ghana'],
        //     ['Gibraltar'],
        //     ['Greece'],
        //     ['Greenland'],
        //     ['Grenada'],
        //     ['Guadeloupe'],
        //     ['Guam'],
        //     ['Guatemala'],
        //     ['Guernsey'],
        //     ['Guinea'],
        //     ['Guinea-Bissau'],
        //     ['Guyana'],
        //     ['Haiti'],
        //     ['Heard Island and McDonald Islands'],
        //     ['Holy See'],
        //     ['Honduras'],
        //     ['Hong Kong'],
        //     ['Hungary'],
        //     ['Iceland'],
        //     ['India'],
        //     ['Indonesia'],
        //     ['Iran IR'],
        //     ['Iraq'],
        //     ['Ireland'],
        //     ['Isle of Man'],
        //     ['Israel'],
        //     ['Italy'],
        //     ['Jamaica'],
        //     ['Japan'],
        //     ['Jersey'],
        //     ['Jordan'],
        //     ['Kazakhstan'],
        //     ['Kenya'],
        //     ['Kiribati'],
        //     ['Korea DPR'],
        //     ['Korea'],
        //     ['Kuwait'],
        //     ['Kyrgyzstan'],
        //     ['Lao Peoples Democratic Republic'],
        //     ['Latvia'],
        //     ['Lebanon'],
        //     ['Lesotho'],
        //     ['Liberia'],
        //     ['Libya'],
        //     ['Liechtenstein'],
        //     ['Lithuania'],
        //     ['Luxembourg'],
        //     ['Macao'],
        //     ['Madagascar'],
        //     ['Malawi'],
        //     ['Malaysia'],
        //     ['Maldives'],
        //     ['Mali'],
        //     ['Malta'],
        //     ['Marshall Islands'],
        //     ['Martinique'],
        //     ['Mauritania'],
        //     ['Mauritius'],
        //     ['Mayotte'],
        //     ['Mexico'],
        //     ['Micronesia'],
        //     ['Moldova'],
        //     ['Monaco'],
        //     ['Mongolia'],
        //     ['Montenegro'],
        //     ['Montserrat'],
        //     ['Morocco'],
        //     ['Mozambique'],
        //     ['Myanmar'],
        //     ['Namibia'],
        //     ['Nauru'],
        //     ['Nepal'],
        //     ['Netherlands'],
        //     ['New Caledonia'],
        //     ['New Zealand'],
        //     ['Nicaragua'],
        //     ['Niger'],
        //     ['Nigeria'],
        //     ['Niue'],
        //     ['Norfolk Island'],
        //     ['North Macedonia'],
        //     ['Northern Mariana Islands'],
        //     ['Norway'],
        //     ['Oman'],
        //     ['Pakistan'],
        //     ['Palau'],
        //     ['Palestine'],
        //     ['Panama'],
        //     ['Papua New Guinea'],
        //     ['Paraguay'],
        //     ['Peru'],
        //     ['Philippines'],
        //     ['Pitcairn'],
        //     ['Poland'],
        //     ['Portugal'],
        //     ['Puerto Rico'],
        //     ['Qatar'],
        //     ['Réunion'],
        //     ['Romania'],
        //     ['Russian Federation'],
        //     ['Rwanda'],
        //     ['Saint Barthélemy'],
        //     ['Saint Helena'],
        //     ['Saint Kitts and Nevis'],
        //     ['Saint Lucia'],
        //     ['Saint Martin (French part)'],
        //     ['Saint Pierre and Miquelon'],
        //     ['Saint Vincent and the Grenadines'],
        //     ['Samoa'],
        //     ['San Marino'],
        //     ['Sao Tome and Principe'],
        //     ['Saudi Arabia'],
        //     ['Senegal'],
        //     ['Serbia'],
        //     ['Seychelles'],
        //     ['Sierra Leone'],
        //     ['Singapore'],
        //     ['Sint Maarten (Dutch part)'],
        //     ['Slovakia'],
        //     ['Slovenia'],
        //     ['Solomon Islands'],
        //     ['Somalia'],
        //     ['South Africa'],
        //     ['South Georgia and the South Sandwich Islands'],
        //     ['South Sudan'],
        //     ['Spain'],
        //     ['Sri Lanka'],
        //     ['Sudan'],
        //     ['Suriname'],
        //     ['Svalbard and Jan Mayen'],
        //     ['Sweden'],
        //     ['Switzerland'],
        //     ['Syrian Arab Republic'],
        //     ['Taiwan (Province of China)'],
        //     ['Tajikistan'],
        //     ['Tanzania'],
        //     ['Thailand'],
        //     ['Timor-Leste'],
        //     ['Togo'],
        //     ['Tokelau'],
        //     ['Tonga'],
        //     ['Trinidad and Tobago'],
        //     ['Tunisia'],
        //     ['Turkey'],
        //     ['Turkmenistan'],
        //     ['Turks and Caicos Islands'],
        //     ['Tuvalu'],
        //     ['Uganda'],
        //     ['Ukraine'],
        //     ['United Arab Emirates'],
        //     ['United Kingdom of Great Britain and Northern Ireland'],
        //     ['United States Minor Outlying Islands'],
        //     ['United States of America'],
        //     ['Uruguay'],
        //     ['Uzbekistan'],
        //     ['Vanuatu'],
        //     ['Venezuela'],
        //     ['Viet Nam'],
        //     ['Virgin Islands (British)'],
        //     ['Virgin Islands (U.S.)'],
        //     ['Wallis and Futuna'],
        //     ['Western Sahara'],
        //     ['Yemen'],
        //     ['Zambia'],
        //     ['Zimbabwe'],
        // ];
        // 换法
        
    </script>
    

    </body>

    </html>

    相关文章

      网友评论

          本文标题:国家数据格式:数组对象匹配国家

          本文链接:https://www.haomeiwen.com/subject/sewcoctx.html