I am building a taxi dispatching app
first: I need the passenger app to show the nearest taxis, now I know how to do that in code but in my way I have to go through all the taxis locations(in database on server) and calculate the distance from the passenger location and get the lowest ones – I don’t want to do this because there will be a lot of taxis and going through all of them and making some math is kind of pain on the server- is there a way to get the nearest ones without going through all of them?
second: what the best database to use – first, should it be sql or non-sql – I need a very robust database, because there will be a lot of updates (I mean the passengers locations added then deleted when arriving to destination && the taxis location changes frequently)
finally: I will use RubyOnRails to do the server side and json as data transfer format, do you have a recommendation to me on something better?
Thanks
For first: Use you need to calculate nearest distance. But instead of comparing with all taxi location i recommend you to pass lat long of passenger.
On server maintain taxi location in lat long. Write query to get taxi’s with in +/- 3 of lat long. This will get limited no of taxi’s available near passenger area.
For sencond: = Use Relational database, SQL Server is good for such applications I have used in my last projects.
For server: I don’t have idea of RubyOnRails but this is also faster & easy to implements as they says.. , you have choose the best data exchange format Json no need to change this; you can use zip to improve performance.