Question based on Location plugin?

Hi All,

I am using the location plugin to get the current location. and also am getting the nearest locations that are available. in my case i need to find the nearest 5 locations that i have to show in the popup with radio button.am getting all the locations.and i need to show the nearest 5 in the popup is any solutions?

Hi Ramesh,

I think, you are getting all nearby locations from plugin, then it will be some list in which locations get stored and it should have distance value also. You need to sort the list by distance ascending order, then you can use top 5 entries from list.

If there is some other scenario then please let us know.

Thanks.

vikas sharma wrote:

Hi Ramesh,

I think, you are getting all nearby locations from plugin, then it will be some list in which locations get stored and it should have distance value also. You need to sort the list by distance ascending order, then you can use top 5 entries from list.

If there is some other scenario then please let us know.

Thanks.


 But the thing is not only getting the nearest 5 locations and also am using the barcode scanner to scan something .If I scan anything in current location it should show the current location. but if I scan that in far away from 10Km then only it should show the nearest  5 Locations that I have to Choose the nearest one.

Thanks Vikas Sharma.



Hi Ramesh,

so according to your problem below can be steps :

1. scan QR code

2. If current location then show current location.

3. Else fetch nearby by locations and sort them and show top 5, as I mentioned in previous reply.