mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-05 15:26:36 +08:00
fix(geo): 修复香港等节点地图质心缺失落到南美占位
补全 Hong Kong/Singapore/Taiwan 质心数据,并改进复合地名与 ISO 匹配, 避免 geo 无精确经纬度时错误回退到巴西等地的占位坐标。
This commit is contained in:
@@ -46,6 +46,7 @@ sidebar: false
|
|||||||
- 明确 OpenResty 健康权威:当前 status/message 以节点表为准,ClickHouse 仅存 status 与连接时序(不含 message)。
|
- 明确 OpenResty 健康权威:当前 status/message 以节点表为准,ClickHouse 仅存 status 与连接时序(不含 message)。
|
||||||
- 看板与节点观测不再展示或采集宿主机网卡入/出站;网络趋势仅保留访问日志的已提供/接收数据。
|
- 看板与节点观测不再展示或采集宿主机网卡入/出站;网络趋势仅保留访问日志的已提供/接收数据。
|
||||||
- 宿主机磁盘读/写趋势改为按小时速率(B/s)展示,摘要为近 24 小时平均速率。
|
- 宿主机磁盘读/写趋势改为按小时速率(B/s)展示,摘要为近 24 小时平均速率。
|
||||||
|
- 修复节点地图在缺少精确经纬度时把香港/新加坡/台湾等地区回退到错误占位坐标的问题;补全质心数据并改进复合地名匹配。
|
||||||
- Pages 部署包上传体积限制改为系统动态配置,默认仍为 100 MiB,可按环境调整。
|
- Pages 部署包上传体积限制改为系统动态配置,默认仍为 100 MiB,可按环境调整。
|
||||||
- 上传新部署后会按保留策略自动清理超出数量的历史部署包,减少磁盘占用。
|
- 上传新部署后会按保留策略自动清理超出数量的历史部署包,减少磁盘占用。
|
||||||
- Agent 在同步 Pages 部署时信任控制面已完成的包校验,不再重复限制文件数与展开体积,仅校验下载完整性并安全解压到本地。
|
- Agent 在同步 Pages 部署时信任控制面已完成的包校验,不再重复限制文件数与展开体积,仅校验下载完整性并安全解压到本地。
|
||||||
|
|||||||
@@ -1,172 +1,702 @@
|
|||||||
{
|
{
|
||||||
"Afghanistan": [65.99254367483304, 33.83349410470984],
|
"Afghanistan": [
|
||||||
"Angola": [17.563198329790602, -12.334557680834592],
|
65.99254367483304,
|
||||||
"Albania": [20.035803636476235, 41.179283471608585],
|
33.83349410470984
|
||||||
"United Arab Emirates": [54.30345828396012, 23.905698042805522],
|
],
|
||||||
"Argentina": [-65.15670576062132, -35.178771590782524],
|
"Albania": [
|
||||||
"Armenia": [44.929379894609674, 40.29884592895426],
|
20.035803636476235,
|
||||||
"France": [165.43817082439585, -21.285375782391018],
|
41.179283471608585
|
||||||
"Australia": [134.361180723562, -25.574955774991995],
|
],
|
||||||
"Austria": [14.10165807418182, 47.57042831528493],
|
"Algeria": [
|
||||||
"Azerbaijan": [47.636777782137415, 40.3311508093757],
|
2.6175172555729325,
|
||||||
"Burundi": [29.873065896828848, -3.3802825292327188],
|
28.158202786113698
|
||||||
"Belgium": [4.628129604331132, 50.646494813466056],
|
],
|
||||||
"Benin": [2.323507643298733, 9.63048313950481],
|
"Angola": [
|
||||||
"Burkina Faso": [-1.7757430610210276, 12.260370131848955],
|
17.563198329790602,
|
||||||
"Bangladesh": [90.21009840315206, 23.88793565572049],
|
-12.334557680834592
|
||||||
"Bulgaria": [25.225364036830744, 42.77785706066581],
|
],
|
||||||
"The Bahamas": [-78.02733865351972, 24.719920319716515],
|
"Argentina": [
|
||||||
"Bosnia and Herzegovina": [17.762461846176542, 44.16398853722456],
|
-65.15670576062132,
|
||||||
"Belarus": [28.04895281233843, 53.53432933090482],
|
-35.178771590782524
|
||||||
"Belize": [-88.72096138346826, 17.17073148225863],
|
],
|
||||||
"Bolivia": [-64.69104972918655, -16.70141507507877],
|
"Armenia": [
|
||||||
"Brazil": [-53.113858151998855, -10.827995867833263],
|
44.929379894609674,
|
||||||
"Brunei": [114.54229268997476, 4.451218476864121],
|
40.29884592895426
|
||||||
"Bhutan": [90.40562361681495, 27.40133623508629],
|
],
|
||||||
"Botswana": [23.791788508036337, -22.185333985163894],
|
"Australia": [
|
||||||
"Central African Republic": [20.490781591297914, 6.563625165826992],
|
134.361180723562,
|
||||||
"Canada": [-102.31777616484295, 57.94457487676815],
|
-25.574955774991995
|
||||||
"Switzerland": [8.205812860319684, 46.805544047201984],
|
],
|
||||||
"Chile": [-71.34891661948937, -35.98028631773855],
|
"Austria": [
|
||||||
"China": [103.79804331240364, 36.61094167680319],
|
14.10165807418182,
|
||||||
"Ivory Coast": [-5.569771898429842, 7.626172775954684],
|
47.57042831528493
|
||||||
"Cameroon": [12.739868035578002, 5.692692453534944],
|
],
|
||||||
"Democratic Republic of the Congo": [23.64811688254194, -2.8775533309965056],
|
"Azerbaijan": [
|
||||||
"Republic of the Congo": [15.21207418503586, -0.8564004333096924],
|
47.636777782137415,
|
||||||
"Colombia": [-73.07794094917405, 3.9235618261252663],
|
40.3311508093757
|
||||||
"Costa Rica": [-84.21742467558424, 9.986463158070535],
|
],
|
||||||
"Cuba": [-78.8954025482625, 21.62136808001903],
|
"Bangladesh": [
|
||||||
"Northern Cyprus": [33.39079188058263, 35.225753269439686],
|
90.21009840315206,
|
||||||
"Cyprus": [33.02409208254226, 34.91304424540028],
|
23.88793565572049
|
||||||
"Czech Republic": [15.330767057694615, 49.70160772219921],
|
],
|
||||||
"Germany": [10.380496796525602, 51.083853487429664],
|
"Belarus": [
|
||||||
"Djibouti": [42.56788631653962, 11.745988995518626],
|
28.04895281233843,
|
||||||
"Denmark": [-41.29088868109839, 74.72535220460091],
|
53.53432933090482
|
||||||
"Dominican Republic": [-70.48595892120278, 18.896879062003393],
|
],
|
||||||
"Algeria": [2.6175172555729325, 28.158202786113698],
|
"Belgium": [
|
||||||
"Ecuador": [-78.38384779532852, -1.4454571869341688],
|
4.628129604331132,
|
||||||
"Egypt": [29.86739912685152, 26.49286512797635],
|
50.646494813466056
|
||||||
"Eritrea": [38.835037148217566, 15.359809600209143],
|
],
|
||||||
"Spain": [-3.5708365129134876, 40.391564705240064],
|
"Belize": [
|
||||||
"Estonia": [25.811350172874032, 58.69303019372469],
|
-88.72096138346826,
|
||||||
"Ethiopia": [39.60372599651433, 8.621595995236198],
|
17.17073148225863
|
||||||
"Finland": [26.28958351526606, 64.52279699210293],
|
],
|
||||||
"Fiji": [177.98415179869738, -17.827004078184217],
|
"Benin": [
|
||||||
"United Kingdom": [-36.367082569942795, -54.468348288665524],
|
2.323507643298733,
|
||||||
"Gabon": [11.774048593462979, -0.5859798536474902],
|
9.63048313950481
|
||||||
"Georgia": [43.48650319000057, 42.175027555818694],
|
],
|
||||||
"Ghana": [-1.2150159067556041, 7.94078880601944],
|
"Bhutan": [
|
||||||
"Guinea": [-10.943568403941383, 10.44078010915303],
|
90.40562361681495,
|
||||||
"Gambia": [-16.21304964555284, 13.37062695465985],
|
27.40133623508629
|
||||||
"Guinea Bissau": [-14.929646023453557, 12.05088889829685],
|
],
|
||||||
"Equatorial Guinea": [10.481670786028316, 1.5660796013647418],
|
"Bolivia": [
|
||||||
"Greece": [22.53435219348475, 39.517734832602365],
|
-64.69104972918655,
|
||||||
"Guatemala": [-90.35344030476544, 15.679044168855697],
|
-16.70141507507877
|
||||||
"Guyana": [-58.978019347627985, 4.800329726037504],
|
],
|
||||||
"Honduras": [-86.65651796671759, 14.821029518594349],
|
"Bosnia and Herzegovina": [
|
||||||
"Croatia": [16.458685366615978, 45.18567759026696],
|
17.762461846176542,
|
||||||
"Haiti": [-72.67866559866681, 18.916195586860297],
|
44.16398853722456
|
||||||
"Hungary": [19.410867145831855, 47.168542742918525],
|
],
|
||||||
"Indonesia": [101.52237404492608, -0.44681277438152994],
|
"Botswana": [
|
||||||
"India": [79.58636900833257, 22.901586798523514],
|
23.791788508036337,
|
||||||
"Ireland": [-8.117695195030898, 53.2341315203433],
|
-22.185333985163894
|
||||||
"Iran": [54.266246557433305, 32.57616445788996],
|
],
|
||||||
"Iraq": [43.74006501790808, 33.0341456153028],
|
"Brazil": [
|
||||||
"Iceland": [-18.509670948264166, 65.03034972428229],
|
-53.113858151998855,
|
||||||
"Israel": [35.241573878810335, 31.94758544099519],
|
-10.827995867833263
|
||||||
"Italy": [12.16233842748749, 43.51281131035235],
|
],
|
||||||
"Jamaica": [-77.32850498837172, 18.172957893241634],
|
"Brunei": [
|
||||||
"Jordan": [36.76131486689134, 31.237145277490367],
|
114.54229268997476,
|
||||||
"Japan": [137.97352453982398, 36.589925009528365],
|
4.451218476864121
|
||||||
"Kashmir": [77.08733723957188, 35.415738932286466],
|
],
|
||||||
"Kazakhstan": [67.27815427190085, 48.155989088140196],
|
"Bulgaria": [
|
||||||
"Kenya": [37.795078751163835, 0.5967194222965451],
|
25.225364036830744,
|
||||||
"Kyrgyzstan": [74.58224715420873, 41.48363475100716],
|
42.77785706066581
|
||||||
"Cambodia": [104.90702345739547, 12.717932969523966],
|
],
|
||||||
"South Korea": [127.87280447602005, 36.475157799464604],
|
"Burkina Faso": [
|
||||||
"Kosovo": [20.851519165302378, 42.51783231278167],
|
-1.7757430610210276,
|
||||||
"Kuwait": [47.566177395781736, 29.316145203902064],
|
12.260370131848955
|
||||||
"Laos": [103.75263811609112, 18.494354885305256],
|
],
|
||||||
"Lebanon": [35.88502277707876, 33.91528991779158],
|
"Burundi": [
|
||||||
"Liberia": [-9.325867879201954, 6.453996218817175],
|
29.873065896828848,
|
||||||
"Libya": [18.008785486000946, 27.031457363755713],
|
-3.3802825292327188
|
||||||
"Sri Lanka": [80.70055059693914, 7.649883097905021],
|
],
|
||||||
"Lesotho": [28.24303757633595, -29.57351232727891],
|
"Cambodia": [
|
||||||
"Lithuania": [23.872793668340726, 55.3142460584835],
|
104.90702345739547,
|
||||||
"Luxembourg": [6.070340274408408, 49.76746140228473],
|
12.717932969523966
|
||||||
"Latvia": [24.89496154477673, 56.853143698564296],
|
],
|
||||||
"Morocco": [-8.459192831832421, 29.83932361976915],
|
"Cameroon": [
|
||||||
"Moldova": [28.446472517363826, 47.2017924696845],
|
12.739868035578002,
|
||||||
"Madagascar": [46.70172536870331, -19.374776628372288],
|
5.692692453534944
|
||||||
"Mexico": [-102.51849775988345, 23.943713432682014],
|
],
|
||||||
"Macedonia": [21.704642152886493, 41.60373573782414],
|
"Canada": [
|
||||||
"Mali": [-3.5321833143642736, 17.347810147640345],
|
-102.31777616484295,
|
||||||
"Myanmar": [96.49588816533908, 21.22201469728619],
|
57.94457487676815
|
||||||
"Montenegro": [19.233365413523355, 42.78395456212118],
|
],
|
||||||
"Mongolia": [103.06423533091326, 46.82560864032323],
|
"Central African Republic": [
|
||||||
"Mozambique": [35.53173663088568, -17.27297477254694],
|
20.490781591297914,
|
||||||
"Mauritania": [-10.34307896458181, 20.259793585678146],
|
6.563625165826992
|
||||||
"Malawi": [34.288911351438394, -13.200363393826267],
|
],
|
||||||
"Malaysia": [114.69201508943004, 3.57724156754415],
|
"Chad": [
|
||||||
"Namibia": [17.208945346875193, -22.132302890947404],
|
18.645815630757973,
|
||||||
"Niger": [9.384787308614277, 17.41758190683491],
|
15.32729896930035
|
||||||
"Nigeria": [8.074235448092892, 9.58958974174772],
|
],
|
||||||
"Nicaragua": [-85.03229930746807, 12.835548864379284],
|
"Chile": [
|
||||||
"Netherlands": [5.646194278986089, 52.27734132368374],
|
-71.34891661948937,
|
||||||
"Norway": [13.994247649210363, 64.32249798565987],
|
-35.98028631773855
|
||||||
"Nepal": [83.9234099472594, 28.243335814044734],
|
],
|
||||||
"New Zealand": [170.54047059084724, -43.955381757717255],
|
"China": [
|
||||||
"Oman": [56.08271927344639, 20.573738446088598],
|
103.79804331240364,
|
||||||
"Pakistan": [69.32988114530586, 29.951585862562073],
|
36.61094167680319
|
||||||
"Panama": [-80.05970573973497, 8.521692369504816],
|
],
|
||||||
"Peru": [-74.38850244798846, -9.156316252308201],
|
"Colombia": [
|
||||||
"Philippines": [121.45754828266669, 15.948824272939182],
|
-73.07794094917405,
|
||||||
"Papua New Guinea": [144.22896759838426, -6.607045399379529],
|
3.9235618261252663
|
||||||
"Poland": [19.379892383012464, 52.11963086628078],
|
],
|
||||||
"United States of America": [-99.14669730710926, 39.52689381707972],
|
"Costa Rica": [
|
||||||
"North Korea": [127.21551783512186, 40.144856985239926],
|
-84.21742467558424,
|
||||||
"Portugal": [-7.977838817691485, 39.6854900148663],
|
9.986463158070535
|
||||||
"Paraguay": [-58.39900641582761, -23.223895588708068],
|
],
|
||||||
"Qatar": [51.170816022848, 25.32876608728452],
|
"Croatia": [
|
||||||
"Romania": [24.971632366248883, 45.84560772065747],
|
16.458685366615978,
|
||||||
"Russia": [99.05228241954488, 61.677043847105494],
|
45.18567759026696
|
||||||
"Rwanda": [29.91765145538139, -1.9953628964377972],
|
],
|
||||||
"Western Sahara": [-12.218085234851758, 24.221135708939354],
|
"Cuba": [
|
||||||
"Saudi Arabia": [44.5342871199886, 24.122854227726673],
|
-78.8954025482625,
|
||||||
"Sudan": [29.946243665370346, 15.99205876641883],
|
21.62136808001903
|
||||||
"South Sudan": [30.253827921202955, 7.307277152400154],
|
],
|
||||||
"Senegal": [-14.472411019597182, 14.338613732351318],
|
"Cyprus": [
|
||||||
"Solomon Islands": [160.156396875585, -9.628589831637283],
|
33.02409208254226,
|
||||||
"Sierra Leone": [-11.82013204896783, 8.575093438325089],
|
34.91304424540028
|
||||||
"El Salvador": [-88.86593554283397, 13.734573052971413],
|
],
|
||||||
"Somaliland": [46.25513292885051, 9.729995248781385],
|
"Czech Republic": [
|
||||||
"Somalia": [45.706539856671256, 4.747960517798881],
|
15.330767057694615,
|
||||||
"Republic of Serbia": [20.766249889622852, 44.19998417744864],
|
49.70160772219921
|
||||||
"Suriname": [-55.91029765824739, 4.126766010517478],
|
],
|
||||||
"Slovakia": [19.47296461136286, 48.71540683451534],
|
"Democratic Republic of the Congo": [
|
||||||
"Slovenia": [14.771193461021065, 46.10807043333343],
|
23.64811688254194,
|
||||||
"Sweden": [16.752551082675275, 62.8354879894394],
|
-2.8775533309965056
|
||||||
"Swaziland": [31.47664514492297, -26.563545981108437],
|
],
|
||||||
"Syria": [38.50449031631095, 35.01769370592341],
|
"Denmark": [
|
||||||
"Chad": [18.645815630757973, 15.32729896930035],
|
-41.29088868109839,
|
||||||
"Togo": [0.949513544830056, 8.576560980195756],
|
74.72535220460091
|
||||||
"Thailand": [101.01060253224972, 15.132319216387051],
|
],
|
||||||
"Tajikistan": [70.98712700685866, 38.55204366339685],
|
"Djibouti": [
|
||||||
"Turkmenistan": [59.39292286662992, 39.1098173228857],
|
42.56788631653962,
|
||||||
"East Timor": [125.78222644041995, -8.858373836074785],
|
11.745988995518626
|
||||||
"Trinidad and Tobago": [-61.270458833911896, 10.339930045317969],
|
],
|
||||||
"Tunisia": [9.546832905099203, 34.12673069029241],
|
"Dominican Republic": [
|
||||||
"Turkey": [35.424986274948736, 38.998407240706534],
|
-70.48595892120278,
|
||||||
"United Republic of Tanzania": [34.79490109621088, -6.276146393386636],
|
18.896879062003393
|
||||||
"Uganda": [32.36575488492427, 1.2757695499320103],
|
],
|
||||||
"Ukraine": [31.381193375918794, 49.01345298489402],
|
"East Timor": [
|
||||||
"Uruguay": [-56.01665573850212, -32.80651677440885],
|
125.78222644041995,
|
||||||
"Uzbekistan": [63.148826727968626, 41.7502616897204],
|
-8.858373836074785
|
||||||
"Venezuela": [-66.1882174671549, 7.118299933056809],
|
],
|
||||||
"Vietnam": [106.29939096235873, 16.63088189612042],
|
"Ecuador": [
|
||||||
"Vanuatu": [166.84228659210697, -15.266627310669035],
|
-78.38384779532852,
|
||||||
"Yemen": [47.546351590294876, 15.935825615412996],
|
-1.4454571869341688
|
||||||
"South Africa": [25.160630055943862, -29.008774283210798],
|
],
|
||||||
"Zambia": [27.775321721593084, -13.460954386993254],
|
"Egypt": [
|
||||||
"Zimbabwe": [29.850564118889274, -19.00677451616593]
|
29.86739912685152,
|
||||||
|
26.49286512797635
|
||||||
|
],
|
||||||
|
"El Salvador": [
|
||||||
|
-88.86593554283397,
|
||||||
|
13.734573052971413
|
||||||
|
],
|
||||||
|
"Equatorial Guinea": [
|
||||||
|
10.481670786028316,
|
||||||
|
1.5660796013647418
|
||||||
|
],
|
||||||
|
"Eritrea": [
|
||||||
|
38.835037148217566,
|
||||||
|
15.359809600209143
|
||||||
|
],
|
||||||
|
"Estonia": [
|
||||||
|
25.811350172874032,
|
||||||
|
58.69303019372469
|
||||||
|
],
|
||||||
|
"Ethiopia": [
|
||||||
|
39.60372599651433,
|
||||||
|
8.621595995236198
|
||||||
|
],
|
||||||
|
"Fiji": [
|
||||||
|
177.98415179869738,
|
||||||
|
-17.827004078184217
|
||||||
|
],
|
||||||
|
"Finland": [
|
||||||
|
26.28958351526606,
|
||||||
|
64.52279699210293
|
||||||
|
],
|
||||||
|
"France": [
|
||||||
|
165.43817082439585,
|
||||||
|
-21.285375782391018
|
||||||
|
],
|
||||||
|
"Gabon": [
|
||||||
|
11.774048593462979,
|
||||||
|
-0.5859798536474902
|
||||||
|
],
|
||||||
|
"Gambia": [
|
||||||
|
-16.21304964555284,
|
||||||
|
13.37062695465985
|
||||||
|
],
|
||||||
|
"Georgia": [
|
||||||
|
43.48650319000057,
|
||||||
|
42.175027555818694
|
||||||
|
],
|
||||||
|
"Germany": [
|
||||||
|
10.380496796525602,
|
||||||
|
51.083853487429664
|
||||||
|
],
|
||||||
|
"Ghana": [
|
||||||
|
-1.2150159067556041,
|
||||||
|
7.94078880601944
|
||||||
|
],
|
||||||
|
"Greece": [
|
||||||
|
22.53435219348475,
|
||||||
|
39.517734832602365
|
||||||
|
],
|
||||||
|
"Guatemala": [
|
||||||
|
-90.35344030476544,
|
||||||
|
15.679044168855697
|
||||||
|
],
|
||||||
|
"Guinea": [
|
||||||
|
-10.943568403941383,
|
||||||
|
10.44078010915303
|
||||||
|
],
|
||||||
|
"Guinea Bissau": [
|
||||||
|
-14.929646023453557,
|
||||||
|
12.05088889829685
|
||||||
|
],
|
||||||
|
"Guyana": [
|
||||||
|
-58.978019347627985,
|
||||||
|
4.800329726037504
|
||||||
|
],
|
||||||
|
"Haiti": [
|
||||||
|
-72.67866559866681,
|
||||||
|
18.916195586860297
|
||||||
|
],
|
||||||
|
"Honduras": [
|
||||||
|
-86.65651796671759,
|
||||||
|
14.821029518594349
|
||||||
|
],
|
||||||
|
"Hong Kong": [
|
||||||
|
114.1747,
|
||||||
|
22.2783
|
||||||
|
],
|
||||||
|
"Hungary": [
|
||||||
|
19.410867145831855,
|
||||||
|
47.168542742918525
|
||||||
|
],
|
||||||
|
"Iceland": [
|
||||||
|
-18.509670948264166,
|
||||||
|
65.03034972428229
|
||||||
|
],
|
||||||
|
"India": [
|
||||||
|
79.58636900833257,
|
||||||
|
22.901586798523514
|
||||||
|
],
|
||||||
|
"Indonesia": [
|
||||||
|
101.52237404492608,
|
||||||
|
-0.44681277438152994
|
||||||
|
],
|
||||||
|
"Iran": [
|
||||||
|
54.266246557433305,
|
||||||
|
32.57616445788996
|
||||||
|
],
|
||||||
|
"Iraq": [
|
||||||
|
43.74006501790808,
|
||||||
|
33.0341456153028
|
||||||
|
],
|
||||||
|
"Ireland": [
|
||||||
|
-8.117695195030898,
|
||||||
|
53.2341315203433
|
||||||
|
],
|
||||||
|
"Israel": [
|
||||||
|
35.241573878810335,
|
||||||
|
31.94758544099519
|
||||||
|
],
|
||||||
|
"Italy": [
|
||||||
|
12.16233842748749,
|
||||||
|
43.51281131035235
|
||||||
|
],
|
||||||
|
"Ivory Coast": [
|
||||||
|
-5.569771898429842,
|
||||||
|
7.626172775954684
|
||||||
|
],
|
||||||
|
"Jamaica": [
|
||||||
|
-77.32850498837172,
|
||||||
|
18.172957893241634
|
||||||
|
],
|
||||||
|
"Japan": [
|
||||||
|
137.97352453982398,
|
||||||
|
36.589925009528365
|
||||||
|
],
|
||||||
|
"Jordan": [
|
||||||
|
36.76131486689134,
|
||||||
|
31.237145277490367
|
||||||
|
],
|
||||||
|
"Kashmir": [
|
||||||
|
77.08733723957188,
|
||||||
|
35.415738932286466
|
||||||
|
],
|
||||||
|
"Kazakhstan": [
|
||||||
|
67.27815427190085,
|
||||||
|
48.155989088140196
|
||||||
|
],
|
||||||
|
"Kenya": [
|
||||||
|
37.795078751163835,
|
||||||
|
0.5967194222965451
|
||||||
|
],
|
||||||
|
"Kosovo": [
|
||||||
|
20.851519165302378,
|
||||||
|
42.51783231278167
|
||||||
|
],
|
||||||
|
"Kuwait": [
|
||||||
|
47.566177395781736,
|
||||||
|
29.316145203902064
|
||||||
|
],
|
||||||
|
"Kyrgyzstan": [
|
||||||
|
74.58224715420873,
|
||||||
|
41.48363475100716
|
||||||
|
],
|
||||||
|
"Laos": [
|
||||||
|
103.75263811609112,
|
||||||
|
18.494354885305256
|
||||||
|
],
|
||||||
|
"Latvia": [
|
||||||
|
24.89496154477673,
|
||||||
|
56.853143698564296
|
||||||
|
],
|
||||||
|
"Lebanon": [
|
||||||
|
35.88502277707876,
|
||||||
|
33.91528991779158
|
||||||
|
],
|
||||||
|
"Lesotho": [
|
||||||
|
28.24303757633595,
|
||||||
|
-29.57351232727891
|
||||||
|
],
|
||||||
|
"Liberia": [
|
||||||
|
-9.325867879201954,
|
||||||
|
6.453996218817175
|
||||||
|
],
|
||||||
|
"Libya": [
|
||||||
|
18.008785486000946,
|
||||||
|
27.031457363755713
|
||||||
|
],
|
||||||
|
"Lithuania": [
|
||||||
|
23.872793668340726,
|
||||||
|
55.3142460584835
|
||||||
|
],
|
||||||
|
"Luxembourg": [
|
||||||
|
6.070340274408408,
|
||||||
|
49.76746140228473
|
||||||
|
],
|
||||||
|
"Macao": [
|
||||||
|
113.5439,
|
||||||
|
22.1987
|
||||||
|
],
|
||||||
|
"Macau": [
|
||||||
|
113.5439,
|
||||||
|
22.1987
|
||||||
|
],
|
||||||
|
"Macedonia": [
|
||||||
|
21.704642152886493,
|
||||||
|
41.60373573782414
|
||||||
|
],
|
||||||
|
"Madagascar": [
|
||||||
|
46.70172536870331,
|
||||||
|
-19.374776628372288
|
||||||
|
],
|
||||||
|
"Malawi": [
|
||||||
|
34.288911351438394,
|
||||||
|
-13.200363393826267
|
||||||
|
],
|
||||||
|
"Malaysia": [
|
||||||
|
114.69201508943004,
|
||||||
|
3.57724156754415
|
||||||
|
],
|
||||||
|
"Mali": [
|
||||||
|
-3.5321833143642736,
|
||||||
|
17.347810147640345
|
||||||
|
],
|
||||||
|
"Mauritania": [
|
||||||
|
-10.34307896458181,
|
||||||
|
20.259793585678146
|
||||||
|
],
|
||||||
|
"Mexico": [
|
||||||
|
-102.51849775988345,
|
||||||
|
23.943713432682014
|
||||||
|
],
|
||||||
|
"Moldova": [
|
||||||
|
28.446472517363826,
|
||||||
|
47.2017924696845
|
||||||
|
],
|
||||||
|
"Mongolia": [
|
||||||
|
103.06423533091326,
|
||||||
|
46.82560864032323
|
||||||
|
],
|
||||||
|
"Montenegro": [
|
||||||
|
19.233365413523355,
|
||||||
|
42.78395456212118
|
||||||
|
],
|
||||||
|
"Morocco": [
|
||||||
|
-8.459192831832421,
|
||||||
|
29.83932361976915
|
||||||
|
],
|
||||||
|
"Mozambique": [
|
||||||
|
35.53173663088568,
|
||||||
|
-17.27297477254694
|
||||||
|
],
|
||||||
|
"Myanmar": [
|
||||||
|
96.49588816533908,
|
||||||
|
21.22201469728619
|
||||||
|
],
|
||||||
|
"Namibia": [
|
||||||
|
17.208945346875193,
|
||||||
|
-22.132302890947404
|
||||||
|
],
|
||||||
|
"Nepal": [
|
||||||
|
83.9234099472594,
|
||||||
|
28.243335814044734
|
||||||
|
],
|
||||||
|
"Netherlands": [
|
||||||
|
5.646194278986089,
|
||||||
|
52.27734132368374
|
||||||
|
],
|
||||||
|
"New Zealand": [
|
||||||
|
170.54047059084724,
|
||||||
|
-43.955381757717255
|
||||||
|
],
|
||||||
|
"Nicaragua": [
|
||||||
|
-85.03229930746807,
|
||||||
|
12.835548864379284
|
||||||
|
],
|
||||||
|
"Niger": [
|
||||||
|
9.384787308614277,
|
||||||
|
17.41758190683491
|
||||||
|
],
|
||||||
|
"Nigeria": [
|
||||||
|
8.074235448092892,
|
||||||
|
9.58958974174772
|
||||||
|
],
|
||||||
|
"North Korea": [
|
||||||
|
127.21551783512186,
|
||||||
|
40.144856985239926
|
||||||
|
],
|
||||||
|
"Northern Cyprus": [
|
||||||
|
33.39079188058263,
|
||||||
|
35.225753269439686
|
||||||
|
],
|
||||||
|
"Norway": [
|
||||||
|
13.994247649210363,
|
||||||
|
64.32249798565987
|
||||||
|
],
|
||||||
|
"Oman": [
|
||||||
|
56.08271927344639,
|
||||||
|
20.573738446088598
|
||||||
|
],
|
||||||
|
"Pakistan": [
|
||||||
|
69.32988114530586,
|
||||||
|
29.951585862562073
|
||||||
|
],
|
||||||
|
"Panama": [
|
||||||
|
-80.05970573973497,
|
||||||
|
8.521692369504816
|
||||||
|
],
|
||||||
|
"Papua New Guinea": [
|
||||||
|
144.22896759838426,
|
||||||
|
-6.607045399379529
|
||||||
|
],
|
||||||
|
"Paraguay": [
|
||||||
|
-58.39900641582761,
|
||||||
|
-23.223895588708068
|
||||||
|
],
|
||||||
|
"Peru": [
|
||||||
|
-74.38850244798846,
|
||||||
|
-9.156316252308201
|
||||||
|
],
|
||||||
|
"Philippines": [
|
||||||
|
121.45754828266669,
|
||||||
|
15.948824272939182
|
||||||
|
],
|
||||||
|
"Poland": [
|
||||||
|
19.379892383012464,
|
||||||
|
52.11963086628078
|
||||||
|
],
|
||||||
|
"Portugal": [
|
||||||
|
-7.977838817691485,
|
||||||
|
39.6854900148663
|
||||||
|
],
|
||||||
|
"Qatar": [
|
||||||
|
51.170816022848,
|
||||||
|
25.32876608728452
|
||||||
|
],
|
||||||
|
"Republic of Serbia": [
|
||||||
|
20.766249889622852,
|
||||||
|
44.19998417744864
|
||||||
|
],
|
||||||
|
"Republic of the Congo": [
|
||||||
|
15.21207418503586,
|
||||||
|
-0.8564004333096924
|
||||||
|
],
|
||||||
|
"Romania": [
|
||||||
|
24.971632366248883,
|
||||||
|
45.84560772065747
|
||||||
|
],
|
||||||
|
"Russia": [
|
||||||
|
99.05228241954488,
|
||||||
|
61.677043847105494
|
||||||
|
],
|
||||||
|
"Rwanda": [
|
||||||
|
29.91765145538139,
|
||||||
|
-1.9953628964377972
|
||||||
|
],
|
||||||
|
"Saudi Arabia": [
|
||||||
|
44.5342871199886,
|
||||||
|
24.122854227726673
|
||||||
|
],
|
||||||
|
"Senegal": [
|
||||||
|
-14.472411019597182,
|
||||||
|
14.338613732351318
|
||||||
|
],
|
||||||
|
"Sierra Leone": [
|
||||||
|
-11.82013204896783,
|
||||||
|
8.575093438325089
|
||||||
|
],
|
||||||
|
"Singapore": [
|
||||||
|
103.8198,
|
||||||
|
1.3521
|
||||||
|
],
|
||||||
|
"Slovakia": [
|
||||||
|
19.47296461136286,
|
||||||
|
48.71540683451534
|
||||||
|
],
|
||||||
|
"Slovenia": [
|
||||||
|
14.771193461021065,
|
||||||
|
46.10807043333343
|
||||||
|
],
|
||||||
|
"Solomon Islands": [
|
||||||
|
160.156396875585,
|
||||||
|
-9.628589831637283
|
||||||
|
],
|
||||||
|
"Somalia": [
|
||||||
|
45.706539856671256,
|
||||||
|
4.747960517798881
|
||||||
|
],
|
||||||
|
"Somaliland": [
|
||||||
|
46.25513292885051,
|
||||||
|
9.729995248781385
|
||||||
|
],
|
||||||
|
"South Africa": [
|
||||||
|
25.160630055943862,
|
||||||
|
-29.008774283210798
|
||||||
|
],
|
||||||
|
"South Korea": [
|
||||||
|
127.87280447602005,
|
||||||
|
36.475157799464604
|
||||||
|
],
|
||||||
|
"South Sudan": [
|
||||||
|
30.253827921202955,
|
||||||
|
7.307277152400154
|
||||||
|
],
|
||||||
|
"Spain": [
|
||||||
|
-3.5708365129134876,
|
||||||
|
40.391564705240064
|
||||||
|
],
|
||||||
|
"Sri Lanka": [
|
||||||
|
80.70055059693914,
|
||||||
|
7.649883097905021
|
||||||
|
],
|
||||||
|
"Sudan": [
|
||||||
|
29.946243665370346,
|
||||||
|
15.99205876641883
|
||||||
|
],
|
||||||
|
"Suriname": [
|
||||||
|
-55.91029765824739,
|
||||||
|
4.126766010517478
|
||||||
|
],
|
||||||
|
"Swaziland": [
|
||||||
|
31.47664514492297,
|
||||||
|
-26.563545981108437
|
||||||
|
],
|
||||||
|
"Sweden": [
|
||||||
|
16.752551082675275,
|
||||||
|
62.8354879894394
|
||||||
|
],
|
||||||
|
"Switzerland": [
|
||||||
|
8.205812860319684,
|
||||||
|
46.805544047201984
|
||||||
|
],
|
||||||
|
"Syria": [
|
||||||
|
38.50449031631095,
|
||||||
|
35.01769370592341
|
||||||
|
],
|
||||||
|
"Taiwan": [
|
||||||
|
120.9605,
|
||||||
|
23.6978
|
||||||
|
],
|
||||||
|
"Tajikistan": [
|
||||||
|
70.98712700685866,
|
||||||
|
38.55204366339685
|
||||||
|
],
|
||||||
|
"Thailand": [
|
||||||
|
101.01060253224972,
|
||||||
|
15.132319216387051
|
||||||
|
],
|
||||||
|
"The Bahamas": [
|
||||||
|
-78.02733865351972,
|
||||||
|
24.719920319716515
|
||||||
|
],
|
||||||
|
"Togo": [
|
||||||
|
0.949513544830056,
|
||||||
|
8.576560980195756
|
||||||
|
],
|
||||||
|
"Trinidad and Tobago": [
|
||||||
|
-61.270458833911896,
|
||||||
|
10.339930045317969
|
||||||
|
],
|
||||||
|
"Tunisia": [
|
||||||
|
9.546832905099203,
|
||||||
|
34.12673069029241
|
||||||
|
],
|
||||||
|
"Turkey": [
|
||||||
|
35.424986274948736,
|
||||||
|
38.998407240706534
|
||||||
|
],
|
||||||
|
"Turkmenistan": [
|
||||||
|
59.39292286662992,
|
||||||
|
39.1098173228857
|
||||||
|
],
|
||||||
|
"Uganda": [
|
||||||
|
32.36575488492427,
|
||||||
|
1.2757695499320103
|
||||||
|
],
|
||||||
|
"Ukraine": [
|
||||||
|
31.381193375918794,
|
||||||
|
49.01345298489402
|
||||||
|
],
|
||||||
|
"United Arab Emirates": [
|
||||||
|
54.30345828396012,
|
||||||
|
23.905698042805522
|
||||||
|
],
|
||||||
|
"United Kingdom": [
|
||||||
|
-36.367082569942795,
|
||||||
|
-54.468348288665524
|
||||||
|
],
|
||||||
|
"United Republic of Tanzania": [
|
||||||
|
34.79490109621088,
|
||||||
|
-6.276146393386636
|
||||||
|
],
|
||||||
|
"United States of America": [
|
||||||
|
-99.14669730710926,
|
||||||
|
39.52689381707972
|
||||||
|
],
|
||||||
|
"Uruguay": [
|
||||||
|
-56.01665573850212,
|
||||||
|
-32.80651677440885
|
||||||
|
],
|
||||||
|
"Uzbekistan": [
|
||||||
|
63.148826727968626,
|
||||||
|
41.7502616897204
|
||||||
|
],
|
||||||
|
"Vanuatu": [
|
||||||
|
166.84228659210697,
|
||||||
|
-15.266627310669035
|
||||||
|
],
|
||||||
|
"Venezuela": [
|
||||||
|
-66.1882174671549,
|
||||||
|
7.118299933056809
|
||||||
|
],
|
||||||
|
"Vietnam": [
|
||||||
|
106.29939096235873,
|
||||||
|
16.63088189612042
|
||||||
|
],
|
||||||
|
"Western Sahara": [
|
||||||
|
-12.218085234851758,
|
||||||
|
24.221135708939354
|
||||||
|
],
|
||||||
|
"Yemen": [
|
||||||
|
47.546351590294876,
|
||||||
|
15.935825615412996
|
||||||
|
],
|
||||||
|
"Zambia": [
|
||||||
|
27.775321721593084,
|
||||||
|
-13.460954386993254
|
||||||
|
],
|
||||||
|
"Zimbabwe": [
|
||||||
|
29.850564118889274,
|
||||||
|
-19.00677451616593
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -153,17 +153,50 @@ function resolveCountryCentroid(geoName: string): CountryCentroid | null {
|
|||||||
if (!trimmed) {
|
if (!trimmed) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
const direct = toCountryCentroid(countryCentroids[trimmed]);
|
const candidates = new Set<string>([trimmed]);
|
||||||
if (direct) {
|
// ipinfo-style names: "Hong Kong, Hong Kong, HK"
|
||||||
return direct;
|
for (const part of trimmed.split(',').map((item) => item.trim())) {
|
||||||
}
|
if (part) {
|
||||||
const lower = trimmed.toLowerCase();
|
candidates.add(part);
|
||||||
for (const [name, coordinates] of Object.entries(countryCentroids)) {
|
|
||||||
if (name.toLowerCase() === lower) {
|
|
||||||
return toCountryCentroid(coordinates);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
// trailing ISO2 often present after city/region
|
||||||
|
const isoMatch = trimmed.match(/\b([A-Z]{2})\b/g);
|
||||||
|
if (isoMatch) {
|
||||||
|
for (const code of isoMatch) {
|
||||||
|
candidates.add(code);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const candidate of candidates) {
|
||||||
|
const direct = toCountryCentroid(countryCentroids[candidate]);
|
||||||
|
if (direct) {
|
||||||
|
return direct;
|
||||||
|
}
|
||||||
|
const lower = candidate.toLowerCase();
|
||||||
|
for (const [name, coordinates] of Object.entries(countryCentroids)) {
|
||||||
|
if (name.toLowerCase() === lower) {
|
||||||
|
return toCountryCentroid(coordinates);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Soft contains match for longer composite labels (prefer longer country names).
|
||||||
|
const lowerFull = trimmed.toLowerCase();
|
||||||
|
let best: { length: number; coords: CountryCentroid } | null = null;
|
||||||
|
for (const [name, coordinates] of Object.entries(countryCentroids)) {
|
||||||
|
const lowerName = name.toLowerCase();
|
||||||
|
if (lowerFull.includes(lowerName) && lowerName.length >= 4) {
|
||||||
|
const coords = toCountryCentroid(coordinates);
|
||||||
|
if (!coords) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!best || lowerName.length > best.length) {
|
||||||
|
best = { length: lowerName.length, coords };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return best?.coords ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getNodeCoordinates(node: DashboardNodeHealth, index: number) {
|
function getNodeCoordinates(node: DashboardNodeHealth, index: number) {
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ var countryCentroidsByName = map[string]countryCentroid{
|
|||||||
"Guyana": {lat: 4.800330, lon: -58.978019},
|
"Guyana": {lat: 4.800330, lon: -58.978019},
|
||||||
"Haiti": {lat: 18.916196, lon: -72.678666},
|
"Haiti": {lat: 18.916196, lon: -72.678666},
|
||||||
"Honduras": {lat: 14.821030, lon: -86.656518},
|
"Honduras": {lat: 14.821030, lon: -86.656518},
|
||||||
|
"Hong Kong": {lat: 22.278300, lon: 114.174700},
|
||||||
"Hungary": {lat: 47.168543, lon: 19.410867},
|
"Hungary": {lat: 47.168543, lon: 19.410867},
|
||||||
"Iceland": {lat: 65.030350, lon: -18.509671},
|
"Iceland": {lat: 65.030350, lon: -18.509671},
|
||||||
"India": {lat: 22.901587, lon: 79.586369},
|
"India": {lat: 22.901587, lon: 79.586369},
|
||||||
@@ -139,6 +140,7 @@ var countryCentroidsByName = map[string]countryCentroid{
|
|||||||
"Saudi Arabia": {lat: 24.122854, lon: 44.534287},
|
"Saudi Arabia": {lat: 24.122854, lon: 44.534287},
|
||||||
"Senegal": {lat: 14.338614, lon: -14.472411},
|
"Senegal": {lat: 14.338614, lon: -14.472411},
|
||||||
"Sierra Leone": {lat: 8.575093, lon: -11.820132},
|
"Sierra Leone": {lat: 8.575093, lon: -11.820132},
|
||||||
|
"Singapore": {lat: 1.352100, lon: 103.819800},
|
||||||
"Slovakia": {lat: 48.715407, lon: 19.472965},
|
"Slovakia": {lat: 48.715407, lon: 19.472965},
|
||||||
"Slovenia": {lat: 46.108070, lon: 14.771193},
|
"Slovenia": {lat: 46.108070, lon: 14.771193},
|
||||||
"Solomon Islands": {lat: -9.628590, lon: 160.156397},
|
"Solomon Islands": {lat: -9.628590, lon: 160.156397},
|
||||||
@@ -155,6 +157,7 @@ var countryCentroidsByName = map[string]countryCentroid{
|
|||||||
"Sweden": {lat: 62.835488, lon: 16.752551},
|
"Sweden": {lat: 62.835488, lon: 16.752551},
|
||||||
"Switzerland": {lat: 46.805544, lon: 8.205813},
|
"Switzerland": {lat: 46.805544, lon: 8.205813},
|
||||||
"Syria": {lat: 35.017694, lon: 38.504490},
|
"Syria": {lat: 35.017694, lon: 38.504490},
|
||||||
|
"Taiwan": {lat: 23.697800, lon: 120.960500},
|
||||||
"Tajikistan": {lat: 38.552044, lon: 70.987127},
|
"Tajikistan": {lat: 38.552044, lon: 70.987127},
|
||||||
"Thailand": {lat: 15.132319, lon: 101.010603},
|
"Thailand": {lat: 15.132319, lon: 101.010603},
|
||||||
"The Bahamas": {lat: 24.719920, lon: -78.027339},
|
"The Bahamas": {lat: 24.719920, lon: -78.027339},
|
||||||
@@ -181,14 +184,28 @@ var countryCentroidsByName = map[string]countryCentroid{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CountryCentroidByName returns latitude and longitude for a country name, if found.
|
// CountryCentroidByName returns latitude and longitude for a country name, if found.
|
||||||
|
// Accepts composite labels such as "Hong Kong, Hong Kong, HK" from GeoIP providers.
|
||||||
func CountryCentroidByName(name string) (lat float64, lon float64, ok bool) {
|
func CountryCentroidByName(name string) (lat float64, lon float64, ok bool) {
|
||||||
name = strings.TrimSpace(name)
|
name = strings.TrimSpace(name)
|
||||||
if name == "" {
|
if name == "" {
|
||||||
return 0, 0, false
|
return 0, 0, false
|
||||||
}
|
}
|
||||||
if v, ok := countryCentroidsByName[name]; ok {
|
if v, found := countryCentroidsByName[name]; found {
|
||||||
return v.lat, v.lon, true
|
return v.lat, v.lon, true
|
||||||
}
|
}
|
||||||
|
// Try comma-separated parts (city / region / country / ISO).
|
||||||
|
for _, part := range strings.Split(name, ",") {
|
||||||
|
part = strings.TrimSpace(part)
|
||||||
|
if part == "" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if v, found := countryCentroidsByName[part]; found {
|
||||||
|
return v.lat, v.lon, true
|
||||||
|
}
|
||||||
|
if lat, lon, ok = CountryCentroidByISO(part); ok {
|
||||||
|
return lat, lon, true
|
||||||
|
}
|
||||||
|
}
|
||||||
return 0, 0, false
|
return 0, 0, false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,3 +11,34 @@ func TestCountryCentroidGermany(t *testing.T) {
|
|||||||
t.Fatalf("unexpected Germany centroid: %f,%f", lat, lon)
|
t.Fatalf("unexpected Germany centroid: %f,%f", lat, lon)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestCountryCentroidHongKongSingaporeTaiwan(t *testing.T) {
|
||||||
|
cases := []struct {
|
||||||
|
iso string
|
||||||
|
name string
|
||||||
|
minLat float64
|
||||||
|
maxLat float64
|
||||||
|
minLon float64
|
||||||
|
maxLon float64
|
||||||
|
}{
|
||||||
|
{iso: "HK", name: "Hong Kong", minLat: 22, maxLat: 23, minLon: 113, maxLon: 115},
|
||||||
|
{iso: "SG", name: "Singapore", minLat: 1, maxLat: 2, minLon: 103, maxLon: 104},
|
||||||
|
{iso: "TW", name: "Taiwan", minLat: 22, maxLat: 26, minLon: 119, maxLon: 122},
|
||||||
|
}
|
||||||
|
for _, tc := range cases {
|
||||||
|
lat, lon, ok := CountryCentroidByISO(tc.iso)
|
||||||
|
if !ok {
|
||||||
|
t.Fatalf("expected %s centroid by ISO", tc.iso)
|
||||||
|
}
|
||||||
|
if lat < tc.minLat || lat > tc.maxLat || lon < tc.minLon || lon > tc.maxLon {
|
||||||
|
t.Fatalf("%s ISO centroid out of range: %f,%f", tc.iso, lat, lon)
|
||||||
|
}
|
||||||
|
lat, lon, ok = CountryCentroidByName(tc.name)
|
||||||
|
if !ok {
|
||||||
|
t.Fatalf("expected %s centroid by name", tc.name)
|
||||||
|
}
|
||||||
|
if lat < tc.minLat || lat > tc.maxLat || lon < tc.minLon || lon > tc.maxLon {
|
||||||
|
t.Fatalf("%s name centroid out of range: %f,%f", tc.name, lat, lon)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user