(Making an Uber like app) I wanna make a global marker for all drivers will be registered on my app with the name shown

I did not use a LocationSensor to make the testing easy. A fixed presentLatitude,presentLongitude ( 42.35914 , -71.09361 ) was used to show the customer. The customer location is shown with a red marker. Set the location LS coordinates (your job) of each user to the presentLatitude,presentLongitude . This is your app, not mine. I cannot provide advice other than I assume your firebase coordinates are the updated coordinates for each driver.

Take some time and see how my example works. Run the example app and make it work for you in your app.. How are you updating the driver's location now?

like that


@mustafaalbasel

Try this instead. :thinking:

Modified example with LocationSensor and ability to display ALL the driver's as Run time Markers

This is just the code required to use the LocationSensor to display the 'passenger/customer' location on the map

All of this is done for you in the New aia Some variables have been 'renamed' to help identify their functions. :slightly_smiling_face:
driverSelectionExample.aia (15.3 KB)

Happy New Year! Now make the example work with your Firebase data.

thanks so much for your effort, really appreciate it,
Lets show me what can i do with my aia file to make it worked, as still a beginner and i tried another way before so am a pretty confused, here is my aia lets fix the blocks and show me how is works, thanks in advance, BTW I used the google sheet instead of firebase to make the file fit with yours that you
driverSelectionExample2.aia (17.3 KB)
added

Sorry, I can't understand your coding. You appear to want to export

0
No (driver number)
Name
phone number
home latitude
home longitude

In the example driver permanent database this will always be

place holder for distance to cusomer (always 0),driver number (assigned manually in the example), driver name, phone number, home latitude, home longitude
0,1,Mustafa,11111111,31.44561,31.67933
0,2,Ahmed,2222222222,42.35137,-71.11377
0,3,Abraham,3333333333,42.36957,-71.08035
0,4,Steve,4444444444,42.36801,-71.11459

The app will change the some databbase information when you ask it to find distance to something like
2.1,1,Mustafa,11111111,31.44598,31.67974
where 2.1 represents the distance in kilometers from the customer, driver number, phone number , presentLatitude (from the LS), presentLongitude (from the LS). It has to sort based on the present coordinates.


You don't need to use the csv, you already have a ListOfLists it appears, it just needs to be set so the columns are the same as above I think.

Perhaps if you show several customers in your GoogleSheets example I can modify the example to use that data. You appear to be trying to fix everything at once. That is complex and impossible for me to understand (possibly as my example is difficult for you to understand :thinking: :frowning_face:

nope i dont want a permanent location, i need an updated location for all by moving so lets adjust the aia file you sent and lets add the firebase or a google sheet to store locations and to get locations from
and all i need that the marker and the tag has the app name (Waslalna) and the driver or customer name for which the checkbox will be enabled which is checkbox customer or checkbox driver and i will make it fit to my app,
thanks in advance for your help
i will make the location initialized for the driver to be always on while opening the GPS and will make the customer when press on find driver btn so the location will be updated to show all drivers markers to select which is nearest to him

and yes that run time all markers i wanna the customer see for drivers on the map for which who is online

1 Like

lets help me for just adding a firebase or google sheet for the aia file and i will make it fit to my app

There are lots of issues.

  • to show all the drivers you need a ListOfLists for all of the drivers
  • to show a ListOfLists for only those drivers who are currently active (those drivers who's locations are updating) you need a list of only those drivers who are signed in and are actively using your app. Only those drivers will have a marker. Can you generate this list?

It should look like this:

place holder for distance to customer (always 0),driver number (assigned manually in the example), driver name, phone number, current latitude, current longitude
0,1,Mustafa,11111111,31.44561,31.67933
0,2,Ahmed,2222222222,42.35137,-71.11377
0,3,Abraham,3333333333,42.36957,-71.08035
0,4,Steve,4444444444,42.36801,-71.11459

The app will change some database information when you ask the app to find distance from the customer (the active LS) to the active drivers and it will produce a ListOfLists that should look something like

2.1,1,Mustafa,11111111,31.44598,31.67974
1.3,2,Ahmed etc.
etc.

2.1 represents the distance in kilometers from the customer, driver number, phone number , presentLatitude (from the LS), presentLongitude (from the LS). The app has to sort distance based on the present coordinates.

  • the example code uses the fullDriverList to provide either all locations or only active locations to generate runtime Markers.

if you have these you can eliminate the csv I use in the example to provide a temporary database and go directly to fullDriverList without converting the csv to a ListOfLists.

You said you want me to 'add a firebase or google sheet for the aia file and you will make it fit to your app ' I've already shown you what it would look like. You have to decide where the List will come from a google sheet or a firebase DB. You seem to be using both.

How ? I don't know exactly whether to use the google sheet or firebase; but you do.

You should provide the ListOfLists of drivers . Use that file to replace the example program's fullDriverList. See images for what I think might work

eliminate the blocks with the x. It refers to the csv, you will not use that or the csv files posted in Media. Then name your list of drivers to replace the fullDriverList (the green check mark)

The app might work with your data. :slightly_smiling_face:

eliminate these blocks
2drivers
3drivers

  • You have to decide whether the driver ListofLists is maintained in either a Firebase or a Google sheet. I don't use either of those.

the list is already in the firebase or googlesheet data until being updated by him but the marker will show his last location the location sensor saved it in, so it just updating the list that already being in the data so all i need markers for saved locations for drivers

alright, will get it a try thanks

1 Like

that example is a great example for what i need

lets just show me how to fix my blocks to make it read from the google sheet as a file same as uploaded to ready my updated locations in the sheet to show their markers on the map same as you did with parks


I don't agree. The National Park tutorial uses a different method of determining nearest than I recommended and does not have a method to 'erase' previously set Runtime Markers. The example I posted removes previously set Runtime Markers. You are welcome to experiment with the NP example as you want. Instead of Runtime Markers you probably would do better using lots of Designtime Markers as a mentioned earlier.

The spreadsheet you posted won't work with NP or my example.

  • The sheet must only contain the most recent coordinates of the drivers . Your current spreadsheet shows every instance of an updated driver's location without replacing the previous location. You want to identify ONLY the most recent locations for the marker. You need to eliminate all the items with a red X. I don't know how you would do that. Your code should have a way restrict the content to ONLY the most recent for each driver. ONLY the green highlighted entries are valid. :frowning_face: You need to fix that. :thinking:

  • also, your spreadsheet has
    a time/date, name, number, latitude,longitude and does not have an item for DISTANCE

2.1,01088,Mustafa,11111111,31.44598,31.67974
1.3,01098,Ali etc.
etc.
while the example uses
2.1,1,Mustafa,11111111,31.44598,31.67974 (it does not have an item for time/date )
1.3,2,Ahmed etc.
etc.

It appears you have done a lot of work. You are still copying code instead of understanding the code unfortunately. Attempting to get everything to work in one step makes your attempts at coding confusing by providing a lot of code that does not work. Seldom does that strategy work.

Good luck with your project.

i listened to your advice and tried your aia file, i just replaced the file with the sheet, just lets make a view and let me know what can i do to make it read same as the file
driverSelectionExample8.aia (17.5 KB)

1 Like

I don't have a solution. Here is what I experimented with.
driverSelectionExampleMustafaData.aia (18.3 KB)
It might help you come up with a solution.

Mustafadata.csv (267 Bytes)
Column H can be used for time. I used the 0\n to get the data that your Web_import added to the original csv. All entries need it but the last entry must not have the \n . The link you provided worked to capture Hassan once, then when I returned to the docs.google document, Hassan was no longer there. I guess you are modifying the document See Mustafadata.csv where I showed how I think the csv should look. When you add an new time with a more recent time, you should not add the driver as a new item, you should REPLACE the previous position.

I load the csv file from an asset. That means you will have to store the modified version in the app's private storage ASD app specific instead. I don't show how to do that. (Asset: Files are read from the app assets. It is an error to write to app assets as they are contained in read-only storage.)

  • you are trying to enter each driver with a sequential id number. Doing that complicates the coding. Instead I suggest everyone gets a permanent id perhaps.

  • The csv Table is named as fullDriverCSV in the File1.GotText block.

  • Create the fullDriverList in Button3 and by assigning fullDriverList to list from scv table text fullDriverCSV (see the Button3 code) . This lets you use what is now a List to calculate the nearest driver

  • run the example. First press the get Spreadsheet contents button to load the csv. Then use the Find nearest driver Sort destinations button. Then you can Post All Drivers Locations. to see where all the drivers are. When you sort, Ahmed becomes the nearest to my location (because I use the LocationSensor to set the customer and I have to use my gps location with the LS to provide an example).

Hope this jumbled discussion helps you fine a way forward.

unfortunately, you made it more hard to me, All my trying is to make the location updated from the google sheet but you back it again to a file which i cant make it works with updated locations, i will try another ways anyway thanks for your response

o avoid using a csv solution you have to download the sheet as a ListOfLists. instead of as a csv as you did ( iz/tq?tqx=out:csv&range=A2:G200&tq=SELECT ] ) or store the customers as a ListOfLists using Firebase.. Can you do that? Sorry, I don't know how.

Anyway good luck.

Is it that much difficult to locate a location/distance between two moving objects using GPS?(with real time update).

Hi @SteveJG your aia project you sent me before was great in the first time and worked well but somehow when i opened it again i found its lagging and closing dont know the reason, can you figure it out please?
UberFirebaseExperiment (1).aia (21.1 KB)

You significantly modified the code I suggested. Now the code will not run.

When I provided the code that initially 'worked', I also provided these cautions:

The test example contains a lot of unfinished example code because I was experimenting. You picked and choosed unrelated code and got into trouble.

I can see these issues:

  • problem #1, your modified app uses your FirebaseToken and your Firebase project settings. . It is not using the default FirebaseDB token. I can't use your tokken.
    When I set the Use Default checkbox for the FirebaseDB , I can get the app to respond (it still is broken because you modified a lot of code snippets).

notDefaultFBtoken defaultFB

  • problem #2; You added a second LocationSensor for the drivers. You should NOT do allow the drivers from the same app. Your 'lagging' is possibly be you now use two LocationSensors to update. I used only the user's location to decide which driver is nearest at the moment.

You are using a FirebaseDb you need to communicate with. The changes to the DB are not made instantaneously. The FirebaseDB needs to be updated. You also have the Map OSM updating. I know some of the OSM servers used by Map can the can get very slow depending on how many other apps are currently accessing the map tiles. LAGGING will occur. You may need the drivers to update their locations using a separate app.


Do you have a copy of the app aia when it last worked for you? You should have made a backup aia or a checkpoint?

I am sorry, I cannot help you fix this. I am glad that the code was useful (until something happened with your modifications).
.
Go back to the last version that worked for you and try again.

Regards,
Steve