'Find locations within 50 km
Sub find_nearestlocs(lat1 As Double,Long1 As Double)
Dim Cursor1 As Cursor
Dim lat11,long11,lat21,long21 As Double
If m_sql.sql1.IsInitialized=False Then
ToastMessageShow("Cannot access locations database",True)
Return
End If
'>>>>All devices get here
lat11=lat1-0.5
lat21=lat1+0.5
Dim r=0.5/Cos(Long1*cPI/180)
long11=Long1+r
long21=Long1-r
Cursor1=m_sql.sql1.ExecQuery2("SELECT * FROM locs1 WHERE lat>? AND lat<? AND long>? AND long<?",Array As String(lat11,lat21,long21,long11))
If Cursor1.RowCount=0 Then
ToastMessageShow("No location found within 50km/35mi - "&Round2(lat1,3)&" "&Round2(Long1,3),True) '>>>>Nexus7/Android 4.4.2 ends here
Return
End If
ToastMessageShow("Location(s) found from "&Round2(lat1,3)&" "&Round2(Long1,3),True)
'>>>> Other devices end here