@@ -14,7 +14,7 @@ class StationManager {
1414
1515 try {
1616 const response = await fetch (
17- "https ://raw.githubusercontent.com/ExpTechTW/API/refs/heads/main/resource/station.csv " ,
17+ "http ://api.core-tyo1.exptech.dev/api/v1/device/list " ,
1818 ) ;
1919 const csvText = await response . text ( ) ;
2020
@@ -51,21 +51,24 @@ class StationManager {
5151
5252 if ( cols . length >= 7 ) {
5353 const id = cols [ 1 ] ;
54- const areaCode = cols [ 5 ] ; // Area code from code column (region code)
54+ const lat = parseFloat ( cols [ 2 ] ) ;
55+ const lon = parseFloat ( cols [ 3 ] ) ;
5556 let net = cols [ 6 ] ;
5657 if ( net === "1" ) net = "SE-Net" ;
5758 else if ( net === "2" ) net = "MS-Net" ;
5859 else if ( net === "3" ) net = "ES-Net" ;
59- const stationCode = cols [ 5 ] ;
60+ else if ( net === "4" ) net = "ES-Pro" ;
61+ const locCode = cols [ 5 ] ;
6062
61- // Only include ES-Net stations
62- if ( net === "ES-Net" ) {
63- const location = this . getLocationName ( stationCode ) ; // Use code column for location lookup
64- // console.log('Adding station:', id, 'code:', stationCode, 'location:', location);
63+ if ( net === "ES-Net" || net === "ES-Pro" ) {
64+ const location = this . getLocationName ( locCode ) ; // Use code column for location lookup
65+ // console.log('Adding station:', id, 'code:', locCode, 'location:', location);
6566 this . stations [ id ] = {
6667 net : net ,
67- areaCode : areaCode ,
68- info : [ { code : stationCode } ] ,
68+ lat : isNaN ( lat ) ? 0 : lat ,
69+ lon : isNaN ( lon ) ? 0 : lon ,
70+ areaCode : locCode ,
71+ info : [ { code : locCode } ] ,
6972 location : location ,
7073 } ;
7174 }
@@ -106,7 +109,7 @@ class StationManager {
106109
107110 getESNetStations ( ) {
108111 return Object . entries ( this . stations )
109- . filter ( ( [ id , station ] ) => station . net === "ES-Net" )
112+ . filter ( ( [ id , station ] ) => station . net === "ES-Net" || station . net === "ES-Pro" )
110113 . map ( ( [ id , station ] ) => ( {
111114 id : id ,
112115 location : station . location || "未知地區" ,
0 commit comments