mirror of
https://github.com/Sosokker/openweathermap-dashboard.git
synced 2025-12-18 13:44:04 +01:00
feat: fix lat, lon not show, delete api key
This commit is contained in:
parent
ad1b63103b
commit
199a7d87f5
@ -7,6 +7,10 @@
|
||||
- [Openweather](https://openweathermap.org/) API Key
|
||||
|
||||
|
||||
1. Go to `docker-compose.yml` and fill Openweathermap API Key
|
||||
|
||||
2. Run compose up
|
||||
|
||||
```bash
|
||||
docker compose up --build --remove-orphans --force-recreate
|
||||
```
|
||||
|
||||
@ -1,245 +0,0 @@
|
||||
Place,Latitude,Longitude
|
||||
Afghanistan,33.0,65.0
|
||||
Albania,41.0,20.0
|
||||
Algeria,28.0,3.0
|
||||
American Samoa,-14.3333,-170.0
|
||||
Andorra,42.5,1.6
|
||||
Angola,-12.5,18.5
|
||||
Anguilla,18.25,-63.1667
|
||||
Antarctica,-90.0,0.0
|
||||
Antigua and Barbuda,17.05,-61.8
|
||||
Argentina,-34.0,-64.0
|
||||
Armenia,40.0,45.0
|
||||
Aruba,12.5,-69.9667
|
||||
Australia,-27.0,133.0
|
||||
Austria,47.3333,13.3333
|
||||
Azerbaijan,40.5,47.5
|
||||
Bahamas,24.25,-76.0
|
||||
Bahrain,26.0,50.55
|
||||
Bangladesh,24.0,90.0
|
||||
Barbados,13.1667,-59.5333
|
||||
Belarus,53.0,28.0
|
||||
Belgium,50.8333,4.0
|
||||
Belize,17.25,-88.75
|
||||
Benin,9.5,2.25
|
||||
Bermuda,32.3333,-64.75
|
||||
Bhutan,27.5,90.5
|
||||
Bolivia,-17.0,-65.0
|
||||
Bosnia and Herzegovina,44.0,18.0
|
||||
Botswana,-22.0,24.0
|
||||
Bouvet Island,-54.4333,3.4
|
||||
Brazil,-10.0,-55.0
|
||||
British Indian Ocean Territory,-6.0,71.5
|
||||
Brunei Darussalam,4.5,114.6667
|
||||
Bulgaria,43.0,25.0
|
||||
Burkina Faso,13.0,-2.0
|
||||
Burundi,-3.5,30.0
|
||||
Cambodia,13.0,105.0
|
||||
Cameroon,6.0,12.0
|
||||
Canada,60.0,-95.0
|
||||
Cape Verde,16.0,-24.0
|
||||
Cayman Islands,19.5,-80.5
|
||||
Central African Republic,7.0,21.0
|
||||
Chad,15.0,19.0
|
||||
Chile,-30.0,-71.0
|
||||
China,35.0,105.0
|
||||
Christmas Island,-10.5,105.6667
|
||||
Cocos (Keeling) Islands,-12.5,96.8333
|
||||
Colombia,4.0,-72.0
|
||||
Comoros,-12.1667,44.25
|
||||
Congo,-1.0,15.0
|
||||
Congo,0.0,25.0
|
||||
Cook Islands,-21.2333,-159.7667
|
||||
Costa Rica,10.0,-84.0
|
||||
Côte d'Ivoire,8.0,-5.0
|
||||
Croatia,45.1667,15.5
|
||||
Cuba,21.5,-80.0
|
||||
Cyprus,35.0,33.0
|
||||
Czech Republic,49.75,15.5
|
||||
Denmark,56.0,10.0
|
||||
Djibouti,11.5,43.0
|
||||
Dominica,15.4167,-61.3333
|
||||
Dominican Republic,19.0,-70.6667
|
||||
Ecuador,-2.0,-77.5
|
||||
Egypt,27.0,30.0
|
||||
El Salvador,13.8333,-88.9167
|
||||
Equatorial Guinea,2.0,10.0
|
||||
Eritrea,15.0,39.0
|
||||
Estonia,59.0,26.0
|
||||
Ethiopia,8.0,38.0
|
||||
Falkland Islands (Malvinas),-51.75,-59.0
|
||||
Faroe Islands,62.0,-7.0
|
||||
Fiji,-18.0,175.0
|
||||
Finland,64.0,26.0
|
||||
France,46.0,2.0
|
||||
French Guiana,4.0,-53.0
|
||||
French Polynesia,-15.0,-140.0
|
||||
French Southern Territories,-43.0,67.0
|
||||
Gabon,-1.0,11.75
|
||||
Gambia,13.4667,-16.5667
|
||||
Georgia,42.0,43.5
|
||||
Germany,51.0,9.0
|
||||
Ghana,8.0,-2.0
|
||||
Gibraltar,36.1833,-5.3667
|
||||
Greece,39.0,22.0
|
||||
Greenland,72.0,-40.0
|
||||
Grenada,12.1167,-61.6667
|
||||
Guadeloupe,16.25,-61.5833
|
||||
Guam,13.4667,144.7833
|
||||
Guatemala,15.5,-90.25
|
||||
Guernsey,49.5,-2.56
|
||||
Guinea,11.0,-10.0
|
||||
Guinea-Bissau,12.0,-15.0
|
||||
Guyana,5.0,-59.0
|
||||
Haiti,19.0,-72.4167
|
||||
Heard Island and McDonald Islands,-53.1,72.5167
|
||||
Holy See (Vatican City State),41.9,12.45
|
||||
Honduras,15.0,-86.5
|
||||
Hong Kong,22.25,114.1667
|
||||
Hungary,47.0,20.0
|
||||
Iceland,65.0,-18.0
|
||||
India,20.0,77.0
|
||||
Indonesia,-5.0,120.0
|
||||
Iran,32.0,53.0
|
||||
Iraq,33.0,44.0
|
||||
Ireland,53.0,-8.0
|
||||
Isle of Man,54.23,-4.55
|
||||
Israel,31.5,34.75
|
||||
Italy,42.8333,12.8333
|
||||
Jamaica,18.25,-77.5
|
||||
Japan,36.0,138.0
|
||||
Jersey,49.21,-2.13
|
||||
Jordan,31.0,36.0
|
||||
Kazakhstan,48.0,68.0
|
||||
Kenya,1.0,38.0
|
||||
Kiribati,1.4167,173.0
|
||||
Korea,40.0,127.0
|
||||
Korea,37.0,127.5
|
||||
Kuwait,29.3375,47.6581
|
||||
Kyrgyzstan,41.0,75.0
|
||||
Lao People's Democratic Republic,18.0,105.0
|
||||
Latvia,57.0,25.0
|
||||
Lebanon,33.8333,35.8333
|
||||
Lesotho,-29.5,28.5
|
||||
Liberia,6.5,-9.5
|
||||
Libyan Arab Jamahiriya,25.0,17.0
|
||||
Liechtenstein,47.1667,9.5333
|
||||
Lithuania,56.0,24.0
|
||||
Luxembourg,49.75,6.1667
|
||||
Macao,22.1667,113.55
|
||||
Macedonia,41.8333,22.0
|
||||
Madagascar,-20.0,47.0
|
||||
Malawi,-13.5,34.0
|
||||
Malaysia,2.5,112.5
|
||||
Maldives,3.25,73.0
|
||||
Mali,17.0,-4.0
|
||||
Malta,35.8333,14.5833
|
||||
Marshall Islands,9.0,168.0
|
||||
Martinique,14.6667,-61.0
|
||||
Mauritania,20.0,-12.0
|
||||
Mauritius,-20.2833,57.55
|
||||
Mayotte,-12.8333,45.1667
|
||||
Mexico,23.0,-102.0
|
||||
Micronesia,6.9167,158.25
|
||||
Moldova,47.0,29.0
|
||||
Monaco,43.7333,7.4
|
||||
Mongolia,46.0,105.0
|
||||
Montenegro,42.0,19.0
|
||||
Montserrat,16.75,-62.2
|
||||
Morocco,32.0,-5.0
|
||||
Mozambique,-18.25,35.0
|
||||
Myanmar,22.0,98.0
|
||||
Namibia,-22.0,17.0
|
||||
Nauru,-0.5333,166.9167
|
||||
Nepal,28.0,84.0
|
||||
Netherlands,52.5,5.75
|
||||
Netherlands Antilles,12.25,-68.75
|
||||
New Caledonia,-21.5,165.5
|
||||
New Zealand,-41.0,174.0
|
||||
Nicaragua,13.0,-85.0
|
||||
Niger,16.0,8.0
|
||||
Nigeria,10.0,8.0
|
||||
Niue,-19.0333,-169.8667
|
||||
Norfolk Island,-29.0333,167.95
|
||||
Northern Mariana Islands,15.2,145.75
|
||||
Norway,62.0,10.0
|
||||
Oman,21.0,57.0
|
||||
Pakistan,30.0,70.0
|
||||
Palau,7.5,134.5
|
||||
Palestinian Territory,32.0,35.25
|
||||
Panama,9.0,-80.0
|
||||
Papua New Guinea,-6.0,147.0
|
||||
Paraguay,-23.0,-58.0
|
||||
Peru,-10.0,-76.0
|
||||
Philippines,13.0,122.0
|
||||
Pitcairn,-24.7,-127.4
|
||||
Poland,52.0,20.0
|
||||
Portugal,39.5,-8.0
|
||||
Puerto Rico,18.25,-66.5
|
||||
Qatar,25.5,51.25
|
||||
Réunion,-21.1,55.6
|
||||
Romania,46.0,25.0
|
||||
Russian Federation,60.0,100.0
|
||||
Rwanda,-2.0,30.0
|
||||
Saint Helena,-15.9333,-5.7
|
||||
Saint Kitts and Nevis,17.3333,-62.75
|
||||
Saint Lucia,13.8833,-61.1333
|
||||
Saint Pierre and Miquelon,46.8333,-56.3333
|
||||
Saint Vincent and the Grenadines,13.25,-61.2
|
||||
Samoa,-13.5833,-172.3333
|
||||
San Marino,43.7667,12.4167
|
||||
Sao Tome and Principe,1.0,7.0
|
||||
Saudi Arabia,25.0,45.0
|
||||
Senegal,14.0,-14.0
|
||||
Serbia,44.0,21.0
|
||||
Seychelles,-4.5833,55.6667
|
||||
Sierra Leone,8.5,-11.5
|
||||
Singapore,1.3667,103.8
|
||||
Slovakia,48.6667,19.5
|
||||
Slovenia,46.0,15.0
|
||||
Solomon Islands,-8.0,159.0
|
||||
Somalia,10.0,49.0
|
||||
South Africa,-29.0,24.0
|
||||
South Georgia and the South Sandwich Islands,-54.5,-37.0
|
||||
South Sudan,8.0,30.0
|
||||
Spain,40.0,-4.0
|
||||
Sri Lanka,7.0,81.0
|
||||
Sudan,15.0,30.0
|
||||
Suriname,4.0,-56.0
|
||||
Svalbard and Jan Mayen,78.0,20.0
|
||||
Swaziland,-26.5,31.5
|
||||
Sweden,62.0,15.0
|
||||
Switzerland,47.0,8.0
|
||||
Syrian Arab Republic,35.0,38.0
|
||||
Taiwan,23.5,121.0
|
||||
Tajikistan,39.0,71.0
|
||||
Tanzania,-6.0,35.0
|
||||
Thailand,15.0,100.0
|
||||
Timor-Leste,-8.55,125.5167
|
||||
Togo,8.0,1.1667
|
||||
Tokelau,-9.0,-172.0
|
||||
Tonga,-20.0,-175.0
|
||||
Trinidad and Tobago,11.0,-61.0
|
||||
Tunisia,34.0,9.0
|
||||
Turkey,39.0,35.0
|
||||
Turkmenistan,40.0,60.0
|
||||
Turks and Caicos Islands,21.75,-71.5833
|
||||
Tuvalu,-8.0,178.0
|
||||
Uganda,1.0,32.0
|
||||
Ukraine,49.0,32.0
|
||||
United Arab Emirates,24.0,54.0
|
||||
United Kingdom,54.0,-2.0
|
||||
United States,38.0,-97.0
|
||||
United States Minor Outlying Islands,19.2833,166.6
|
||||
Uruguay,-33.0,-56.0
|
||||
Uzbekistan,41.0,64.0
|
||||
Vanuatu,-16.0,167.0
|
||||
Venezuela,8.0,-66.0
|
||||
Viet Nam,16.0,106.0
|
||||
Virgin Islands British,18.5,-64.5
|
||||
Virgin Islands U.S.,18.3333,-64.8333
|
||||
Wallis and Futuna,-13.3,-176.2
|
||||
Western Sahara,24.5,-13.0
|
||||
Yemen,15.0,48.0
|
||||
Zambia,-15.0,30.0
|
||||
Zimbabwe,-20.0,30.0
|
||||
|
@ -1,78 +0,0 @@
|
||||
Place,Latitude,Longitude
|
||||
กรุงเทพมหานคร,13.7278956,100.52412349999997
|
||||
กระบี่,8.0862997,98.90628349999997
|
||||
กาญจนบุรี,14.0227797,99.53281149999998
|
||||
กาฬสินธุ์,16.4314078,103.5058755
|
||||
กำแพงเพชร,16.4827798,99.52266179999992
|
||||
ขอนแก่น,16.4419355,102.8359921
|
||||
จันทบุรี,12.61134,102.10385459999998
|
||||
ฉะเชิงเทรา,13.6904194,101.07795959999999
|
||||
ชลบุรี,13.3611431,100.98467170000004
|
||||
ชัยนาท,15.1851971,100.12512500000003
|
||||
ชัยภูมิ,15.8068173,102.03150270000003
|
||||
ชุมพร,10.4930496,99.18001989999993
|
||||
เชียงราย,19.9071656,99.83095500000002
|
||||
เชียงใหม่,18.7877477,98.99313110000003
|
||||
ตรัง,7.5593851,99.61100650000003
|
||||
ตราด,12.2427563,102.51747339999997
|
||||
ตาก,16.8839901,99.12584979999997
|
||||
นครนายก,14.2069466,101.21305110000003
|
||||
นครปฐม,13.8199206,100.06216760000007
|
||||
นครพนม,17.392039,104.76955079999993
|
||||
นคราชสีมา,14.9798997,102.09776929999998
|
||||
นครศรีธรรมราช,8.4303975,99.96312190000003
|
||||
นครสวรรค์,15.6930072,100.12255949999997
|
||||
นนทบุรี,13.8621125,100.51435279999998
|
||||
นราธิวาส,6.4254607,101.82531429999995
|
||||
น่าน,18.7756318,100.77304170000002
|
||||
บุรีรัมย์,14.9930017,103.10291910000001
|
||||
ปทุมธานี,14.0208391,100.52502759999993
|
||||
ประจวบคีรีขันธ์,11.812367,99.79732709999996
|
||||
ปราจีนบุรี,14.0509704,101.37274389999993
|
||||
ปัตตานี,6.869484399999999,101.25048259999994
|
||||
พระนครศรีอยุธยา,14.3532128,100.56895989999998
|
||||
พะเยา,19.1664789,99.9019419
|
||||
พังงา,8.4407456,98.51930319999997
|
||||
พัทลุง,7.6166823,100.07402309999998
|
||||
พิจิตร,16.4429516,100.34823289999997
|
||||
พิษณุโลก,16.8298048,100.26149150000003
|
||||
เพชรบุรี,13.1111601,99.93913069999996
|
||||
เพชรบูรณ์,16.4189807,101.15509259999999
|
||||
แพร่,18.1445774,100.14028310000003
|
||||
ภูเก็ต,7.9810496,98.36388239999997
|
||||
มหาสารคาม,16.1850896,103.30264609999995
|
||||
มุกดาหาร,16.542443,104.72091509999996
|
||||
แม่ฮ่องสอน,19.2990643,97.96562259999996
|
||||
ยโสธร,15.792641,104.14528270000005
|
||||
ยะลา,6.541147,101.28039469999999
|
||||
ร้อยเอ็ด,16.0538196,103.65200359999994
|
||||
ระนอง,9.9528702,98.60846409999999
|
||||
ระยอง,12.6833115,101.23742949999996
|
||||
ราชบุรี,13.5282893,99.81342110000003
|
||||
ลพบุรี,14.7995081,100.65337060000002
|
||||
ลำปาง,18.2888404,99.49087399999996
|
||||
ลำพูน,18.5744606,99.0087221
|
||||
เลย,17.4860232,101.72230020000006
|
||||
ศรีสะเกษ,15.1186009,104.32200949999992
|
||||
สกลนคร,17.1545995,104.1348365
|
||||
สงขลา,7.1756004,100.61434699999995
|
||||
สตูล,6.6238158,100.06737440000006
|
||||
สมุทรปราการ,13.5990961,100.59983190000003
|
||||
สมุทรสงคราม,13.4098217,100.00226450000002
|
||||
สมุทรสาคร,13.5475216,100.27439559999993
|
||||
สระแก้ว,13.824038,102.0645839
|
||||
สระบุรี,14.5289154,100.91014210000003
|
||||
สิงห์บุรี,14.8936253,100.39673140000002
|
||||
สุโขทัย,17.0055573,99.82637120000004
|
||||
สุพรรณบุรี,14.4744892,100.11771279999994
|
||||
สุราษฎร์ธานี,9.1382389,99.32174829999997
|
||||
สุรินทร์,14.882905,103.49371070000007
|
||||
หนองคาย,17.8782803,102.74126380000007
|
||||
หนองบัวลำภู,17.2218247,102.42603680000002
|
||||
อ่างทอง,14.5896054,100.45505200000002
|
||||
อำนาจเจริญ,15.8656783,104.62577740000006
|
||||
อุดรธานี,17.4138413,102.78723250000007
|
||||
อุตรดิตถ์,17.6200886,100.09929420000003
|
||||
อุทัยธานี,15.3835001,100.02455269999996
|
||||
อุบลราชธานี,15.2286861,104.85642170000006
|
||||
บึงกาฬ,18.3609104,103.64644629999998
|
||||
|
14
cmd/main.go
14
cmd/main.go
@ -188,12 +188,12 @@ func main() {
|
||||
mux.HandleFunc("/api/data", rawDataHandler) // /api/data?scale=100
|
||||
|
||||
handler := cors.Default().Handler(mux)
|
||||
c := cors.New(cors.Options{
|
||||
AllowedOrigins: []string{"*"},
|
||||
AllowCredentials: true,
|
||||
AllowedHeaders: []string{"Authorization", "Content-Type", "Access-Control-Allow-Origin"},
|
||||
AllowedMethods: []string{"GET", "UPDATE", "PUT", "POST", "DELETE"},
|
||||
})
|
||||
handler = c.Handler(handler)
|
||||
// c := cors.New(cors.Options{
|
||||
// AllowedOrigins: []string{"*"},
|
||||
// AllowCredentials: true,
|
||||
// AllowedHeaders: []string{"Authorization", "Content-Type", "Access-Control-Allow-Origin"},
|
||||
// AllowedMethods: []string{"GET", "UPDATE", "PUT", "POST", "DELETE"},
|
||||
// })
|
||||
// handler = c.Handler(handler)
|
||||
log.Fatal(http.ListenAndServe(":8080", handler))
|
||||
}
|
||||
|
||||
130
data/data.csv
130
data/data.csv
@ -1,130 +0,0 @@
|
||||
Place,Latitude,Longitude
|
||||
AK,63.588753,-154.493062
|
||||
AL,32.318231,-86.902298
|
||||
AR,35.20105,-91.831833
|
||||
AZ,34.048928,-111.093731
|
||||
CA,36.778261,-119.417932
|
||||
CO,39.550051,-105.782067
|
||||
CT,41.603221,-73.087749
|
||||
DC,38.905985,-77.033418
|
||||
DE,38.910832,-75.52767
|
||||
FL,27.664827,-81.515754
|
||||
GA,32.157435,-82.907123
|
||||
HI,19.898682,-155.665857
|
||||
IA,41.878003,-93.097702
|
||||
ID,44.068202,-114.742041
|
||||
IL,40.633125,-89.398528
|
||||
IN,40.551217,-85.602364
|
||||
KS,39.011902,-98.484246
|
||||
KY,37.839333,-84.270018
|
||||
LA,31.244823,-92.145024
|
||||
MA,42.407211,-71.382437
|
||||
MD,39.045755,-76.641271
|
||||
ME,45.253783,-69.445469
|
||||
MI,44.314844,-85.602364
|
||||
MN,46.729553,-94.6859
|
||||
MO,37.964253,-91.831833
|
||||
MS,32.354668,-89.398528
|
||||
MT,46.879682,-110.362566
|
||||
NC,35.759573,-79.0193
|
||||
ND,47.551493,-101.002012
|
||||
NE,41.492537,-99.901813
|
||||
NH,43.193852,-71.572395
|
||||
NJ,40.058324,-74.405661
|
||||
NM,34.97273,-105.032363
|
||||
NV,38.80261,-116.419389
|
||||
NY,43.299428,-74.217933
|
||||
OH,40.417287,-82.907123
|
||||
OK,35.007752,-97.092877
|
||||
OR,43.804133,-120.554201
|
||||
PA,41.203322,-77.194525
|
||||
PR,18.220833,-66.590149
|
||||
RI,41.580095,-71.477429
|
||||
SC,33.836081,-81.163725
|
||||
SD,43.969515,-99.901813
|
||||
TN,35.517491,-86.580447
|
||||
TX,31.968599,-99.901813
|
||||
UT,39.32098,-111.093731
|
||||
VA,37.431573,-78.656894
|
||||
VT,44.558803,-72.577841
|
||||
WA,47.751074,-120.740139
|
||||
WI,43.78444,-88.787868
|
||||
WV,38.597626,-80.454903
|
||||
WY,43.075968,-107.290284
|
||||
กรุงเทพมหานคร,13.7278956,100.52412349999997
|
||||
กระบี่,8.0862997,98.90628349999997
|
||||
กาญจนบุรี,14.0227797,99.53281149999998
|
||||
กาฬสินธุ์,16.4314078,103.5058755
|
||||
กำแพงเพชร,16.4827798,99.52266179999992
|
||||
ขอนแก่น,16.4419355,102.8359921
|
||||
จันทบุรี,12.61134,102.10385459999998
|
||||
ฉะเชิงเทรา,13.6904194,101.07795959999999
|
||||
ชลบุรี,13.3611431,100.98467170000004
|
||||
ชัยนาท,15.1851971,100.12512500000003
|
||||
ชัยภูมิ,15.8068173,102.03150270000003
|
||||
ชุมพร,10.4930496,99.18001989999993
|
||||
เชียงราย,19.9071656,99.83095500000002
|
||||
เชียงใหม่,18.7877477,98.99313110000003
|
||||
ตรัง,7.5593851,99.61100650000003
|
||||
ตราด,12.2427563,102.51747339999997
|
||||
ตาก,16.8839901,99.12584979999997
|
||||
นครนายก,14.2069466,101.21305110000003
|
||||
นครปฐม,13.8199206,100.06216760000007
|
||||
นครพนม,17.392039,104.76955079999993
|
||||
นคราชสีมา,14.9798997,102.09776929999998
|
||||
นครศรีธรรมราช,8.4303975,99.96312190000003
|
||||
นครสวรรค์,15.6930072,100.12255949999997
|
||||
นนทบุรี,13.8621125,100.51435279999998
|
||||
นราธิวาส,6.4254607,101.82531429999995
|
||||
น่าน,18.7756318,100.77304170000002
|
||||
บุรีรัมย์,14.9930017,103.10291910000001
|
||||
ปทุมธานี,14.0208391,100.52502759999993
|
||||
ประจวบคีรีขันธ์,11.812367,99.79732709999996
|
||||
ปราจีนบุรี,14.0509704,101.37274389999993
|
||||
ปัตตานี,6.869484399999999,101.25048259999994
|
||||
พระนครศรีอยุธยา,14.3532128,100.56895989999998
|
||||
พะเยา,19.1664789,99.9019419
|
||||
พังงา,8.4407456,98.51930319999997
|
||||
พัทลุง,7.6166823,100.07402309999998
|
||||
พิจิตร,16.4429516,100.34823289999997
|
||||
พิษณุโลก,16.8298048,100.26149150000003
|
||||
เพชรบุรี,13.1111601,99.93913069999996
|
||||
เพชรบูรณ์,16.4189807,101.15509259999999
|
||||
แพร่,18.1445774,100.14028310000003
|
||||
ภูเก็ต,7.9810496,98.36388239999997
|
||||
มหาสารคาม,16.1850896,103.30264609999995
|
||||
มุกดาหาร,16.542443,104.72091509999996
|
||||
แม่ฮ่องสอน,19.2990643,97.96562259999996
|
||||
ยโสธร,15.792641,104.14528270000005
|
||||
ยะลา,6.541147,101.28039469999999
|
||||
ร้อยเอ็ด,16.0538196,103.65200359999994
|
||||
ระนอง,9.9528702,98.60846409999999
|
||||
ระยอง,12.6833115,101.23742949999996
|
||||
ราชบุรี,13.5282893,99.81342110000003
|
||||
ลพบุรี,14.7995081,100.65337060000002
|
||||
ลำปาง,18.2888404,99.49087399999996
|
||||
ลำพูน,18.5744606,99.0087221
|
||||
เลย,17.4860232,101.72230020000006
|
||||
ศรีสะเกษ,15.1186009,104.32200949999992
|
||||
สกลนคร,17.1545995,104.1348365
|
||||
สงขลา,7.1756004,100.61434699999995
|
||||
สตูล,6.6238158,100.06737440000006
|
||||
สมุทรปราการ,13.5990961,100.59983190000003
|
||||
สมุทรสงคราม,13.4098217,100.00226450000002
|
||||
สมุทรสาคร,13.5475216,100.27439559999993
|
||||
สระแก้ว,13.824038,102.0645839
|
||||
สระบุรี,14.5289154,100.91014210000003
|
||||
สิงห์บุรี,14.8936253,100.39673140000002
|
||||
สุโขทัย,17.0055573,99.82637120000004
|
||||
สุพรรณบุรี,14.4744892,100.11771279999994
|
||||
สุราษฎร์ธานี,9.1382389,99.32174829999997
|
||||
สุรินทร์,14.882905,103.49371070000007
|
||||
หนองคาย,17.8782803,102.74126380000007
|
||||
หนองบัวลำภู,17.2218247,102.42603680000002
|
||||
อ่างทอง,14.5896054,100.45505200000002
|
||||
อำนาจเจริญ,15.8656783,104.62577740000006
|
||||
อุดรธานี,17.4138413,102.78723250000007
|
||||
อุตรดิตถ์,17.6200886,100.09929420000003
|
||||
อุทัยธานี,15.3835001,100.02455269999996
|
||||
อุบลราชธานี,15.2286861,104.85642170000006
|
||||
บึงกาฬ,18.3609104,103.64644629999998
|
||||
|
@ -1,4 +0,0 @@
|
||||
Place,Latitude,Longitude
|
||||
AK,63.588753,-154.493062
|
||||
AL,32.318231,-86.902298
|
||||
AR,35.20105,-91.831833
|
||||
|
@ -5,7 +5,7 @@ services:
|
||||
networks:
|
||||
- internal-net
|
||||
environment:
|
||||
- OPENWEATHERMAP_API_KEY=34fec0bf50b5e8cc6c2070005ea3d5b0
|
||||
- OPENWEATHERMAP_API_KEY=fillme
|
||||
|
||||
nginx:
|
||||
build:
|
||||
|
||||
@ -7,31 +7,26 @@ server {
|
||||
server_name localhost;
|
||||
|
||||
location / {
|
||||
if ($request_method = 'OPTIONS') {
|
||||
add_header 'Access-Control-Allow-Origin' '*';
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
|
||||
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
|
||||
add_header 'Access-Control-Max-Age' 1728000;
|
||||
add_header 'Content-Type' 'text/plain; charset=utf-8';
|
||||
add_header 'Content-Length' 0;
|
||||
return 204;
|
||||
}
|
||||
if ($request_method = 'POST') {
|
||||
add_header 'Access-Control-Allow-Origin' '*';
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
|
||||
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
|
||||
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
|
||||
}
|
||||
if ($request_method = 'GET') {
|
||||
add_header 'Access-Control-Allow-Origin' '*';
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
|
||||
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
|
||||
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
|
||||
}
|
||||
|
||||
proxy_pass http://backend:8080;
|
||||
if ($request_method = 'OPTIONS') {
|
||||
add_header 'Access-Control-Allow-Origin' '*';
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
|
||||
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
|
||||
add_header 'Access-Control-Max-Age' 1728000;
|
||||
add_header 'Content-Type' 'text/plain; charset=utf-8';
|
||||
add_header 'Content-Length' 0;
|
||||
return 204;
|
||||
}
|
||||
|
||||
if ($http_access_control_allow_origin = "") {
|
||||
add_header 'Access-Control-Allow-Origin' '*';
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
|
||||
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
|
||||
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
|
||||
}
|
||||
|
||||
proxy_pass http://backend:8080;
|
||||
}
|
||||
|
||||
location /report {
|
||||
root html;
|
||||
index index.html;
|
||||
|
||||
@ -68,8 +68,8 @@
|
||||
tableHTML += `
|
||||
<tr>
|
||||
<td>${data.name || "N/A"}</td>
|
||||
<td>${data.lat || 0}</td>
|
||||
<td>${data.lon || 0}</td>
|
||||
<td>${data.coord.lat || 0}</td>
|
||||
<td>${data.coord.lon || 0}</td>
|
||||
<td>${data.rain["1h"] || "N/A"}</td>
|
||||
</tr>`;
|
||||
});
|
||||
|
||||
@ -1,57 +0,0 @@
|
||||
#main-section {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
margin: 2.5rem
|
||||
}
|
||||
|
||||
#statistic {
|
||||
flex: 1;
|
||||
min-width: 300px;
|
||||
background: #ffffff;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||
padding: 1.5rem;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#table-section {
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
#map {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2rem;
|
||||
flex: 2;
|
||||
min-width: 600px;
|
||||
}
|
||||
|
||||
|
||||
// from https://codepen.io/zass-udd/pen/NWqKmdE
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
td, th {
|
||||
border: 1px solid #dddddd;
|
||||
text-align: center;
|
||||
padding:6px 20px;
|
||||
}
|
||||
tr th {
|
||||
border: 1px solid #dddddd;
|
||||
text-align: center;
|
||||
padding:6px 20px;
|
||||
background-color: #ad1e23;
|
||||
color:#fff;
|
||||
}
|
||||
|
||||
tr:hover {
|
||||
background-color: #dddddd;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.content td, .content th {
|
||||
border-top: 1px solid transparent;
|
||||
padding: 2px 10px 2px 15px;
|
||||
}
|
||||
213
web/index.html
213
web/index.html
@ -1,213 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Graph</title>
|
||||
<script src="https://cdn.plot.ly/plotly-3.0.0.min.js" charset="utf-8"></script>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css2?family=Outfit:wght@100..900&family=Roboto:ital,wght@0,100..900;1,100..900&display=swap"
|
||||
rel="stylesheet">
|
||||
<link rel="stylesheet" href="./index.css">
|
||||
|
||||
<style>
|
||||
body {
|
||||
font-family: "Roboto", sans-serif;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="main-section">
|
||||
<div id="statistic">
|
||||
<h2>Rainfall Statistics</h2>
|
||||
<p>Today rain/hr.</p>
|
||||
<div id="table-section">
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th rowspan="2"><strong>Location</strong></th>
|
||||
<th colspan="2"><strong>Coordinate</strong></th>
|
||||
<th rowspan="2"><strong>Rain Per Hour</strong></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Latitude</th>
|
||||
<th>Longitude</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>8</td>
|
||||
<td>0.395</td>
|
||||
<td>±8</td>
|
||||
<td>50.27</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>10</td>
|
||||
<td>0.617</td>
|
||||
<td>±6</td>
|
||||
<td>78.54</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>12</td>
|
||||
<td>0.888</td>
|
||||
<td>±6</td>
|
||||
<td>113.10</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>16</td>
|
||||
<td>1.580</td>
|
||||
<td>±5</td>
|
||||
<td>201.06</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>20</td>
|
||||
<td>2.470</td>
|
||||
<td>±5</td>
|
||||
<td>314.16</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>22</td>
|
||||
<td>2.984</td>
|
||||
<td>±4</td>
|
||||
<td>380.13</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>25</td>
|
||||
<td>3.850</td>
|
||||
<td>±4</td>
|
||||
<td>490.88</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>28</td>
|
||||
<td>4.840</td>
|
||||
<td>±4</td>
|
||||
<td>615.75</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>32</td>
|
||||
<td>6.310</td>
|
||||
<td>±4</td>
|
||||
<td>804.25</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div id="map">
|
||||
<script>
|
||||
async function fetchData(scale) {
|
||||
let url = "http://localhost:8080/api/data";
|
||||
if (scale === true) {
|
||||
url += "?scale=true"
|
||||
}
|
||||
|
||||
try {
|
||||
const res = await fetch(url)
|
||||
const weatherData = await res.json()
|
||||
return weatherData
|
||||
} catch {
|
||||
console.error(error)
|
||||
return null
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<div id="rain-marker">
|
||||
<script>
|
||||
async function updateRainMarker() {
|
||||
const weatherData = await fetchData(false);
|
||||
if (!weatherData) {
|
||||
return;
|
||||
}
|
||||
|
||||
const lon = weatherData.map((location) => location.coord.lon);
|
||||
const lat = weatherData.map((location) => location.coord.lat);
|
||||
const text = weatherData.map(
|
||||
(location) =>
|
||||
`${location.name}: ${location.rain["1h"]} mm/hr (${location.weather[0].description})`
|
||||
);
|
||||
|
||||
const data = [
|
||||
{
|
||||
type: "scattergeo",
|
||||
mode: "markers+text",
|
||||
lon: lon,
|
||||
lat: lat,
|
||||
marker: {
|
||||
color: "rgb(17, 157, 255)",
|
||||
size: 10,
|
||||
},
|
||||
text: text,
|
||||
textposition: "bottom right",
|
||||
},
|
||||
];
|
||||
|
||||
const layout = {
|
||||
map: { center: { lon: -110, lat: 50 }, zoom: 3.3 },
|
||||
geo: {
|
||||
center: { lon: -100, lat: 40 },
|
||||
zoom: 3,
|
||||
},
|
||||
showlegend: false,
|
||||
height: 500,
|
||||
width: 750,
|
||||
};
|
||||
|
||||
Plotly.newPlot("rain-marker", data, layout);
|
||||
}
|
||||
|
||||
updateRainMarker();
|
||||
</script>
|
||||
</div>
|
||||
<div id="rain-density">
|
||||
<script>
|
||||
async function updateRainDensity() {
|
||||
const weatherData = await fetchData(true);
|
||||
if (!weatherData) {
|
||||
console.error("Failed to fetch weather data for rain-density.");
|
||||
return;
|
||||
}
|
||||
|
||||
const locations = weatherData.map((location) => location.coord.place);
|
||||
console.log(weatherData)
|
||||
console.log(locations)
|
||||
const z = weatherData.map((location) => location.rain["1h"]);
|
||||
var data = [
|
||||
{
|
||||
type: "choroplethmap",
|
||||
name: "Rainfall Per Hour",
|
||||
geojson:
|
||||
"https://raw.githubusercontent.com/python-visualization/folium/master/examples/data/us-states.json",
|
||||
// state-id, rainfall (scale 100)
|
||||
locations: locations,
|
||||
z: z,
|
||||
zmin: 0,
|
||||
zmax: 100,
|
||||
colorscale: "Blues",
|
||||
reversescale: true,
|
||||
colorbar: {
|
||||
y: 0,
|
||||
yanchor: "bottom",
|
||||
title: { text: "Rainfall Per Hour", side: "right" },
|
||||
marker: { line: { width: 1, color: "white" } },
|
||||
},
|
||||
},
|
||||
];
|
||||
var layout = {
|
||||
map: { style: "dark", center: { lon: -110, lat: 50 }, zoom: 3.3 },
|
||||
width: 750,
|
||||
height: 500,
|
||||
margin: { t: 0, b: 0 },
|
||||
};
|
||||
Plotly.newPlot("rain-density", data, layout);
|
||||
}
|
||||
|
||||
updateRainDensity();
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Loading…
Reference in New Issue
Block a user