In my iphone app, I have a sqlite table with latitudes and longitudes of USA(All weather stations of USA) . What is the sqlite query to check whether given latitude and longitude is in a set of lat/lon in sqlite?
I mean I have the lat/lon set of New York as (42.75,73.80),(37,-122) but am searching with a lat/lon which is near New York, like (42.10,73.20)
How to find if this (42.10,73.20) is near New York?
- Answer for mtoepper
Custom Functions in SQLITE (Eg.ACOS) //Include this code in your project
static void ACOSFunc(sqlite3_context *context, int argc, sqlite3_value **argv) { assert(argc == 1); if (sqlite3_value_type(argv[0]) == SQLITE_NULL) { sqlite3_result_null(context); return; } double input = sqlite3_value_double(argv[0]); sqlite3_result_double(context, acos(input) ); }
And add this after creating database connection.
sqlite3_create_function(db.sqliteHandle, "ACOS", 1, SQLITE_UTF8, NULL, &ACOSFunc, NULL, NULL);