Ah, I'm not familiar with `entur` - but, if you're willing to go through the setup with the Google Maps API key in the Readme instructions, I can help configure the widget for you. Just let me know!
Yep, you need to enable billing for it in the Google Cloud Console. Google has a very generous free tier (~$200 a month), so, practically speaking, you will never incur any real charges
Here's an example: Your project consumes 10,000 API requests per month at the price of $1 for every 1,000 requests. In theory, you would owe $10 per month to Google for the service. However, you have $100 a month in credits, so the $10 is deducted from that. You still have $90 in credit for the month left over and haven't really paid anything out of pocket.
This looks amazing. But for nonprogrammers, what do you need to do to set it up? I got an API key and downloaded Scriptable, but now I'm stuck. I assume I create a new script on Scriptable, but where do I find the script to input? Eventually I figured out that I should copy the script under the "Index" tab, and delete the header and footer. But then I am not sure how to add the origin. Are these added from within Google Cloud somewhere? Or directly in the code? And if the latter, what syntax should we use?
Ah, let me see if I can help you. I'll give some background context and then next best steps that you can take.
For starters, you're very nearly there. Having the API key and Scriptable downloaded is far and away the thing that takes the most time.
For context, an index.js file at the root folder is typically the bare-bones implementation, so it's best suited for someone who can read Javascript and knows what needs to be tweaked. In your case, it will probably make much more sense to check out the examples folder and use one of my other Javascript files, for example, this one which is the most complete version:
So, to add your own Google Maps Key, you would change it like this
const GOOGLE_MAPS_API_KEY = "ABC123";
Note: That the "" must still be there, these are called strings in the programming language - Likewise, you can also edit the string values of the variables for route_1 and route_2 label, origin, destination.
Like you guessed, all you need to do is copy the entire file over and make a new Script file within Scriptable. You won't have to change anything in Google Console after getting your API key and adding it within the Scriptable script itself.
Thanks so much for this info. I was able to figure it out and get the widget working. (And sorry, my reply was delayed by the understandable blackout.)
However, I've found that the times listed aren't accurate! Not sure why but they are always out of sync with my extremely reliable Transit app. Maybe just the limitations of Google?
I got it working if anyone is interested after trying a few things so here you have the source code, it currently has 6 routes of 2 trains (rail option) and 4 subway by using 2 columns of 3 routes each
Hey y'all, any chance someone can give me pointers on customizing this code for NYC subway use? I've done all other steps (API, scriptable download). The widget will run and display the labels I've designated, but no times of trains for either route will display.
Unfortunately, it runs off of the Google Maps API primarily. If you give me the origin station and the destination station I can try plugging it in and seeing what comes up!
6
u/scriptable-transit Sep 23 '22
https://github.com/trevorwhealy/scriptable-transit
Shows when your next few trains will arrive ✅
Hope you like it!
2
u/[deleted] Sep 23 '22
Nice. Did try to create for Norway/Oslo but was too complicated for my skill level so i gave up.
2
u/cnylkew Nov 15 '22
Enable billing for project?
2
u/macrophilosopher Jun 05 '23 edited Jun 05 '23
This looks amazing. But for nonprogrammers, what do you need to do to set it up? I got an API key and downloaded Scriptable, but now I'm stuck. I assume I create a new script on Scriptable, but where do I find the script to input? Eventually I figured out that I should copy the script under the "Index" tab, and delete the header and footer. But then I am not sure how to add the origin. Are these added from within Google Cloud somewhere? Or directly in the code? And if the latter, what syntax should we use?
2
u/[deleted] Feb 01 '23
This one is awesome, is there a way of adding another column of other two routes?
4
u/clempat Sep 24 '22
I really wonder why applications like Citymapper does not have something like that!
This is great. Thanks for sharing.
1
u/YogurtclosetOpen1714 Apr 22 '24
Hey y'all, any chance someone can give me pointers on customizing this code for NYC subway use? I've done all other steps (API, scriptable download). The widget will run and display the labels I've designated, but no times of trains for either route will display.
const route_1_label = "Westbound L";
const route_1_origin = "1 Av";
const route_1_destination = "14 St / 8 Av";
const route_2_label = "Uptown";
const route_2_origin = "14 St-Union Sq";
const route_2_destination = "86";
1
u/satshow Jan 03 '25
Is this possible for train in the netherlands? I know there is a api. I have android.
1
u/jetnarsense Sep 24 '22
This is the exact reason why i know our city doesn't have an API for the transit system lol
The widgets look slick btw
1
u/foufou51 Oct 15 '22
Hi late to the party but is this possible using Apple map ? My city doesn’t provides its data to Google maps but it does to Apple Maps… Thanks
3
u/lizardheartruthminer Sep 23 '22
Don’t have any coins to give an award but this is amazing!
2
u/mistermantas Sep 25 '22
incredible
2
u/kavehwaddell Jun 23 '23
Incredible work. Thank you for making it easy for amateurs to get this set up. Thrilled to have Caltrain times on the homescreen.