#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(
![SQLiteにて現在地と一番近い位置データを検索する - Qiita](https://cdn-ak-scissors.b.st-hatena.com/image/square/84be3c7981a9af8197a75f2f34759fc59cf36bab/height=288;version=1;width=512/https%3A%2F%2Fqiita-user-contents.imgix.net%2Fhttps%253A%252F%252Fcdn.qiita.com%252Fassets%252Fpublic%252Farticle-ogp-background-1150d8b18a7c15795b701a55ae908f94.png%3Fixlib%3Drb-1.2.2%26w%3D1200%26mark%3Dhttps%253A%252F%252Fqiita-user-contents.imgix.net%252F~text%253Fixlib%253Drb-1.2.2%2526w%253D840%2526h%253D380%2526txt%253DSQLite%2525E3%252581%2525AB%2525E3%252581%2525A6%2525E7%25258F%2525BE%2525E5%25259C%2525A8%2525E5%25259C%2525B0%2525E3%252581%2525A8%2525E4%2525B8%252580%2525E7%252595%2525AA%2525E8%2525BF%252591%2525E3%252581%252584%2525E4%2525BD%25258D%2525E7%2525BD%2525AE%2525E3%252583%252587%2525E3%252583%2525BC%2525E3%252582%2525BF%2525E3%252582%252592%2525E6%2525A4%25259C%2525E7%2525B4%2525A2%2525E3%252581%252599%2525E3%252582%25258B%2526txt-color%253D%252523333%2526txt-font%253DAvenir-Black%2526txt-size%253D54%2526txt-clip%253Dellipsis%2526txt-align%253Dcenter%25252Cmiddle%2526s%253D89d400779efe701ca5135dedac544c45%26mark-align%3Dcenter%252Cmiddle%26blend%3Dhttps%253A%252F%252Fqiita-user-contents.imgix.net%252F~text%253Fixlib%253Drb-1.2.2%2526w%253D840%2526h%253D500%2526txt%253D%252540s1140227%2526txt-color%253D%252523333%2526txt-font%253DAvenir-Black%2526txt-size%253D45%2526txt-align%253Dright%25252Cbottom%2526s%253D8f18173be994cb0880302e90bff823aa%26blend-align%3Dcenter%252Cmiddle%26blend-mode%3Dnormal%26s%3D1d2b8ec111186722315d9071c78585a1)