Metalab / oeffimonitor

Displays an info screen with the next Wiener Linien public transport connections nearby.
GNU Affero General Public License v3.0
47 stars 21 forks source link

Webserver data vanished #32

Closed LuegM closed 5 months ago

LuegM commented 5 months ago

What am I doing wrong? As soon as the second api request is made, the website only shows this: CleanShot 2024-06-03 at 21 24 19@2x

pi@oeffi:~/oeffimonitor $ npm start

> oeffimonitor@0.1.2 start
> NODE_ENV='production' node server/httpd.js

Server up on port 8080
API: new request
OSRM: new request for [ 16.370215, 48.2353357 ]
resolved for [ 16.370215, 48.2353357 ] 221083.2
API: new request
API: new request

settings.js

// add your API key here
// const api_key = 'XXXXXXXXXX';

// define all RBLs of stops you want to display
const api_ids = [
//  "4650",    // Ubahn - U6 – Siebenhirten
//  "4641",   //  Ubahn - U6 - Floridsdorf
//  "1199",   //  Bus - 5B - Praterstern
//  "2204",   //  Bus - 5B - Heiligenstadt
  "2157",   //  Bim - 33 - Josefstädter Straße
];

const api_url = 'http://www.wienerlinien.at/ogd_realtime/monitor' +
  '?activateTrafficInfo=stoerunglang' +
//  `&sender=${api_key}`+
  '&rbl=' + api_ids.join("&rbl=");

// define filters to exclude specific departures from the monitor
// currently you can exclude lines as a whole or only at certain stops
const filters = [
];

// define your current location
const location_coordinate = '48.235252,16.3686969'

// define OSRM server for routing to stops. Empty string to disable feature
const osrm_api_url = 'http://router.project-osrm.org/route/v1/foot/' + location_coordinate + ';'

module.exports = {
  'api_url'         : api_url,
  'api_ids'         : api_ids,
  'filters'         : filters,
  'api_cache_msec'  : 20000,   // cache API responses for this many milliseconds; default: 6s
  'listen_port'     : 8080,   // port to listen on
  'osrm_api_url'    : osrm_api_url
};

The API still shows correct data.

rcknr commented 5 months ago

You need your own API key from Wiener Linien.

On Mon, 3 Jun 2024, 22:27 Michael Luegmayer, @.***> wrote:

What am I doing wrong? As soon as the second api request is made, the website only shows this: @.*** (view on web) https://github.com/Metalab/oeffimonitor/assets/94018890/e6d2545f-df05-49fc-bf2f-e3892821504d

@.***:~/oeffimonitor $ npm start

@.*** start> NODE_ENV='production' node server/httpd.js

Server up on port 8080 API: new request OSRM: new request for [ 16.370215, 48.2353357 ] resolved for [ 16.370215, 48.2353357 ] 221083.2 API: new request API: new request

settings.js

// add your API key here// const api_key = 'XXXXXXXXXX'; // define all RBLs of stops you want to displayconst api_ids = [// "4650", // Ubahn - U6 – Siebenhirten// "4641", // Ubahn - U6 - Floridsdorf// "1199", // Bus - 5B - Praterstern// "2204", // Bus - 5B - Heiligenstadt "2157", // Bim - 33 - Josefstädter Straße]; const api_url = 'http://www.wienerlinien.at/ogd_realtime/monitor' + '?activateTrafficInfo=stoerunglang' +// &sender=${api_key}+ '&rbl=' + api_ids.join("&rbl=");

// define filters to exclude specific departures from the monitor// currently you can exclude lines as a whole or only at certain stopsconst filters = []; // define your current locationconst location_coordinate = '48.235252,16.3686969' // define OSRM server for routing to stops. Empty string to disable featureconst osrm_api_url = 'http://router.project-osrm.org/route/v1/foot/' + location_coordinate + ';'

module.exports = { 'api_url' : api_url, 'api_ids' : api_ids, 'filters' : filters, 'api_cache_msec' : 20000, // cache API responses for this many milliseconds; default: 6s 'listen_port' : 8080, // port to listen on 'osrm_api_url' : osrm_api_url};``

— Reply to this email directly, view it on GitHub https://github.com/Metalab/oeffimonitor/issues/32, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADTAGZVNMJ463LRX53SX5TZFS7TXAVCNFSM6AAAAABIXDTA4WVHI2DSMVQWIX3LMV43ASLTON2WKOZSGMZTCOBYGE4DANI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

LuegM commented 5 months ago

@rcknr

I don't think so: https://www.wienerlinien.at/open-data

The README also says this:

No API Key needed anymore. (See: Open Data Info Page of Wiener Linien (DE))

Furthermore the (local) API gets the correct data from the Wiener Linien API, it's just not displayed correct.

LuegM commented 5 months ago

The walk duration seems to be the problem as it shows much too high numbers which are then filtered:

"countdown": 6,
"walkDuration": 221083.2,
"walkStatus": "too late"
LuegM commented 5 months ago

I didn't follow this step 🙈💀

Attention: OSRM API uses lon,lat as input, you will need to switch the coordinates in the location_coordinate variable, as they are usually in lat,lon format (e.g. from OSM)!