He's referring to the function here:

http://www.thismuchiknow.co.uk/?p=71


#define DEG2RAD(degrees) (degrees * 0.01745327) // degrees * pi over 180

static void distanceFunc(sqlite3_context *context, int argc, sqlite3_value 
**argv)
{
// check that we have four arguments (lat1, lon1, lat2, lon2)
assert(argc == 4);
// check that all four arguments are non-null
if (sqlite3_value_type(argv[0]) == SQLITE_NULL || 
sqlite3_value_type(argv[1]) == SQLITE_NULL || sqlite3_value_type(argv[2]) 
== SQLITE_NULL || sqlite3_value_type(argv[3]) == SQLITE_NULL) {
sqlite3_result_null(context);
return;
}
// get the four argument values
double lat1 = sqlite3_value_double(argv[0]);
double lon1 = sqlite3_value_double(argv[1]);
double lat2 = sqlite3_value_double(argv[2]);
double lon2 = sqlite3_value_double(argv[3]);
// convert lat1 and lat2 into radians now, to avoid doing it twice below
double lat1rad = DEG2RAD(lat1);
double lat2rad = DEG2RAD(lat2);
// apply the spherical law of cosines to our latitudes and longitudes, and 
set the result appropriately
// 6378.1 is the approximate radius of the earth in kilometres
sqlite3_result_double(context, acos(sin(lat1rad) * sin(lat2rad) + 
cos(lat1rad) * cos(lat2rad) * cos(DEG2RAD(lon2) - DEG2RAD(lon1))) * 6378.1);
}


On Monday, October 1, 2012 3:18:33 PM UTC-5, Lew wrote:
>
> saex, in case you are wondering what just happened, RichardC asked you to 
> increase the effort
> you put into communicating with those who might volunteer to help you for 
> no reward other than 
> personal goodness. Instead you were rude and condescending, the exact 
> opposite of courtesy, 
> much less effort. From this RichardC reached the valid engineering 
> conclusion that you are not
> serious about seeking assistance.
>
> I share this because I haven't seen your handle before, and I suspect you 
> might not yet possess
> the context to properly interpret the social interaction. I am giving you 
> the benefit of the doubt 
> that you do not actually intend to be rude, condescending and hostile. I 
> am giving you the 
> advice to be considerate, professional and cooperative.
>
> More specifically, "the function of the accepted answer....." suffers from 
> being semantically null, 
> that is, conveying absolutely no information whatsoever, and from a 
> plethora of superfluous 
> periods. Asking an empty question, then refusing to fill it when asked, is 
> a surefire way to make 
> it impossible to answer the question, and unlikely that anyone will want 
> to.
>
> -- 
> Lew
>
> On Monday, October 1, 2012 7:17:48 AM UTC-7, RichardC wrote:
>>
>> So I guess you don't want any help then.
>>
>> On Monday, October 1, 2012 3:11:21 PM UTC+1, saex wrote:
>>>
>>> Obviously the function of the accepted answer.....
>>>
>>> El lunes, 1 de octubre de 2012 15:42:59 UTC+2, RichardC escribió:
>>>>
>>>> What function?
>>>>
>>>> You need to put more effort into your questions, do not expect others 
>>>> to do all your work for you.
>>>>
>>>> On Monday, October 1, 2012 2:34:32 PM UTC+1, saex wrote:
>>>>>
>>>>> How can i add that function to my sqlite database in Android?
>>>>>
>>>>> and how can i use it ?
>>>>>
>>>>> thanks
>>>>>
>>>>> El lunes, 1 de octubre de 2012 14:11:06 UTC+2, RichardC escribió:
>>>>>>
>>>>>>
>>>>>> http://stackoverflow.com/questions/3168904/sql-query-to-query-nearby-points-of-interest-based-on-lat-long-sqlite
>>>>>>
>>>>>>
>>>>>> On Monday, October 1, 2012 12:53:58 PM UTC+1, saex wrote:
>>>>>>>
>>>>>>> I must obtain a SQLite SQL Sentence for ordering by nearest latitude 
>>>>>>> and longitude coordinates, given a initial location.
>>>>>>>
>>>>>>> THis is a example sentence for my table in the sqlite database:
>>>>>>>
>>>>>>> SELECT id, name, lat, lng FROM items
>>>>>>>
>>>>>>> I must achieve this with SQLite, and with that table. I can't use 
>>>>>>> another techniques because this is for a existen SQlite database that i 
>>>>>>> can't change.
>>>>>>>
>>>>>>> Exists a way to achieve this with Android and SQlite? I checked a 
>>>>>>> lot of stackoverflow posts and i didn't find the way to achieve that
>>>>>>>
>>>>>>> Thanks
>>>>>>>
>>>>>>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to