I want to made transit app. This app can track real time and see route of a car in one screen. Can I made it with thunkable ?
Do you have some reference or tutorial I so new on this.
you can start with this (my first app). on start, the app gathers alerts and notifications in the system, if any, then displays the number of trains currently in the system.
in order to do this, our transit system, BART (bay area transit system), has made their API (api.bart.gov/) available for querying the system via the web.
my first app uses two of the simplest calls to the API. you can read the doc , and study the code, so you can see how to set up the call, then how to process the return data (which luckily is available in JSON format).
here is a copy of the project: https://x.thunkable.com/copy/bfc841793b8b16d18b8e4595259fdf3c
when you are ready to handle the structured format of live data (train data). i can share my other BART app, which displays the trains arriving at any time, at any BART station (of your choice).
Thank but i still confuse.
try studying how this app https://x.thunkable.com/projects/5e46212bed3a9fd9b0f28461/7e0effbc-113a-431c-a0b8-20530d9e9f04/designer was coded. it shows how a call is made to the API with city name, how to obtain a specific json field and how to display it. it can even show a map, based on the longitude and latitude of the city selected. i hope this helps.
As a matter of fact, THIS is the app I remixed in order to make my bart advisory app!
Let me try one more time with a simpler example.
BART (san francisco bay area rapid transit) has made an API (application program interface) available to allow anyone to perform queries about the system by typing a special form of URL and supplying the needed parameters. let’s say we want to request the number of trains active in the system. you can go to http://api.bart.gov/, click Advisories, click count, to see how to formulate the url. it happens to be:
(the json and key parts must always be supplied - the key is the public key for the API)
when we enter this url in the browser we get this response:
it is a display of a “tree” with two branches: “?xml” and “root”, which itself expands into five branches namely: uri, date, time, traincount, message. in JSON, the tree is called response while a branch is called property.
so the field we want is the value of the property called ‘traincount’ which is part of the property called ‘root’ which is part of the original object called ‘response’.
i have created a small app that performs this function only. see below.
the blocks above show how it is coded in thunkable - we formulate the query into a url string as defined above, then we “GET” the url to perform the API request, then we process the JSON response, almost word for word as described in the last paragraph.
regarding your project of showing the path of any route, you need to find out if the transit system at your location has provided an API for making queries against the system. the BART API contains queries about a routeinfo which is made up of several stations. there is a query for stninfo which can return the longitude and latitude of the station. and the map component has a capability of drawing markers and polylines on a map. i believe it is possible to draw the path of any train route in the system using the capabilities of the API and the features of the map component…
you’ll need to be familiar in handling the formats of the various JSON responses. you can look at the tutorials for more examples.
Thanks for sharing this @manyone - it a really helpful resource for the community, much appreciated!
My transit system dont have API what I should do ?
Then you’ve got a big job ahead of you!
Assuming your transit system is like this.
If all you want to do is draw the path of a route, then you need to define at least 2 database tables:
STNS – table of stations, each row containing station id, name, latitude, longitude
ROUTES – table of routes, each row defining the stations in sequence to complete the route.
“A-C” , [A,B,C]
“C-G” , [C,D,E,F,G]
“G-A” , [G,H,I,A]
Then when you get a route from input, look up the ROUTES table and iterate over the list of stations corresponding to that route, and for each station, look up the STNS to get the latitude and longitude for that station, then call Map.AddMarker to place a marker on the map. You’ll need to repeat the process but call Map.addPolyLine to draw the path.
I’ve never actually done this myself but the methods available in the Map component seem to suggest that it will work.
Can i custom marker ?
As far as I know, we can only use 1 marker in x thunkable, it’s the red circle pointing down as if it’s saying, “look here below”. No other option.