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

You need to learn to code to build your Uber like app. It is not possible to slightly mofify the CloudDB / Location Marker Tutorial. The tutorial uses routines and examples that can be used in the NEW app you code.

Here is what I suggest:

  • build a test app that does not use a LocationSensor that will let you decide how you want to handle the different things you need to do in your app. If you do not initially use a LS you can make the basic parts more simply.
  • I expect you will want to make an example of how you will handle drivers, customer, calculate distance to customer (routine of one way shown in tutorial), etc

-You might want to make a list or csv: like this:
1,Mustafa,11111111,42.36646,-71.11139\n
2,Ahmed,2222222222,42.35137,-71.11377\n
3,Abraham,3333333333,42.36957,-71.08035\n
4,Steve ,4444444444,42.36801,-71.11459

containing Marker Number, Name, phone number, home latitude, home longitude to place in driver's Marker nearest the customer or number of open seats available in the driver's vehicle and anything else the driver should share with the customer.

  • Here are some simple possibilities to handle drivers:

  • if you have a List of drivers (name, coordinates, availability, phone contact) in your firebase it is easy to determine which is the nearest available driver. Determine the nearest to the user (customer) and post only the nearest driver available as Marker1 to show the driver location on your map. Calculate either straight line distance between the customer and driver or more complexly using the Navigate tool to determine nearest driver. Straight line distance should be good in most instances and not significantly different than road driving distance.

  • alternatively post the Markers for all the drivers on the Map.

  • just determine the nearest available driver to the customer. Provide the customer with the drivers name, distance and phone number. You don't even have to have a map to provide the info the customer needs to identify.

  • it is possible to use circles on the map to show the distance of all the drivers available and various other schemes. Most other options will just use up more of your realtime database time to post fancy things on the Map.

When you get one part working save it as a separate project. Keep marking individual parts work, then combine them to make the app you want. To do that you will have to experiment.

This is a long holiday here. I am visiting with my grandchild so sorry I can't be more specific as programming is not what I expect to do for the next week through New Year.

ok thanks for you reply, have a good holiday

You can try something like this @mustafaalbasel

Sorted Driver Distance Matrix -
shortestDistanceFromCustomer.aia (12.6 KB)

The example I use with a CloudDB. You can do something similar with your FirebaseDB or Spreadsheet. For the example I did not use a LocationSensor to make the testing easy. A fixed presentLatitude,presentLongitude ( 42.35914 , -71.09361 ) was used instead to show the customer. The location is shown with a red marker. You can later set the location to the LS coordinates (your job).

  • if you have a List of drivers (place holder for distance, driver number, name, phone contact, coordinates, availability, number of passengers that can be carried) in your firebase it can be easy to determine which is the nearest available driver. Determine the nearest to the user (customer) and post only the nearest driver available as Marker1 to show the driver location on your map. Calculate either straight line distance between the customer and driver( or more complexly using the Navigate tool) to determine nearest driver. Straight line distance should be good in most instances and not significantly different than road driving distance.

  • I've also was able to post the Markers for all the drivers using Run time Markers (with slightly different code) using a diffferent example. Posting all the driver Markers can get messy and may be slow on the OSM map server.

  • just determine the nearest available driver to the customer. Provide the customer with the drivers name, distance and phone number and other data like number of seats available. You don't even have to have a map to provide the info the customer needs to identify.

  • Label5 displays the distances in km. for all the drivers. Presently set to Visibility false.

  • Label6 displays all the driver info (not pretty) and the distance from the customer. Presently set to Visibility false.

  • Lable7 displays the distance from the driver nearest the customer in km.

UdriversSorted.csv (168 Bytes)
0,1,Mustafa,11111111,42.36646,-71.11139\n
0,2,Ahmed,2222222222,42.35137,-71.11377\n
0,3,Abraham,3333333333,42.36957,-71.08035\n
0,4,Steve,4444444444,42.36801,-71.11459

Is this what you wanted to know? :thinking:

thanks so much for your effort, i will try to check it but lets help me about that
i see you are getting the locations from the csv file or sheets but how can i adjust blocks to get locaions from the firebase instead of the csv file and that are my tags
you can advice me to change the tag if needed

and what can i add here in the missing blck ?

You do not need to add anything. I just works without the empty block. :slightly_smiling_face:

You need to do the changes.

To work in the example you need six items
where 0 is a temporary value, 1 is a driver number, Mustafa is a driver name, 1111111111 is a phone number followed by the driver's coordinates.

0,1,Mustafa,11111111,42.36646,-71.11139
0,2,Ahmed,2222222222,42.35137,-71.11377
0,3,Abraham,3333333333,42.36957,-71.08035
0,4,Steve,4444444444,42.36801,-71.11459

looks close to what you already have in your database. :thinking:

ok but lets show me the block of the global num+1
to make the sequence
1
2
3

111111111
22222222
33333333
44444444
and lets let me know how can i usefirebase instead of the csv file and i will try, thanks in advance

1,2,3,4 driver numbers are entered manually.

I recommend you use some of your data and modify it to look like the example data,
then run the example with the data you modified.

but when i dont wanna a fixed location so drivers are moving everywhere so i wanna an updated location so the data will be always updated so when the customer search for the nearest one or we can say like public markers if the customer searched by the app name which will be in all users tags so all markers has the app name will be appeared and he can choose whatever he want so i can add anything manually

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