K-Nearest Neighbors for Fast and Accurate Qibla Direction Determination
DOI:
https://doi.org/10.12928/mf.v7i1.12781Keywords:
Qibla Direction, K-Nearest Neighbors, Recommendation System, Latitude, LongitudeAbstract
Determining the correct direction of the Qibla is essential for the validity of prayer, but in areas far from the Kaaba, this can be a challenge. While calculating the Qibla azimuth using latitude and longitude is relatively straightforward, traditional methods for obtaining the Qibla direction, such as those provided by the Muhammadiyah Central Leadership’s Tarjih Center, are time-consuming and require specialized teams. This paper proposes a recommendation system that uses the K-Nearest Neighbors (K-NN) algorithm to provide an efficient and automated solution for determining the Qibla direction. The system leverages the Google Maps API to obtain geographic coordinates and calculates the Qibla azimuth by applying the Euclidean distance formula between latitude and longitude points. The K-NN method is employed to recommend the nearest mosque or prayer room that is aligned with the correct Qibla direction, based on proximity and geographic data. This approach eliminates the need for a dedicated team and significantly reduces the time required for users to find the correct direction. The system's performance was tested through Black Box testing to ensure all features functioned as expected. User acceptance was measured using the System Usability Scale (SUS), resulting in an average score of 76.33, indicating good usability. Additionally, accuracy testing compared the recommended Qibla direction from 28 mosques and prayer rooms with another established system, yielding an accuracy of 78.57%. These results demonstrate that the proposed K-NN-based recommendation system is both effective and efficient for determining the Qibla direction.
References
D. Tanjung, “Urgensi Kalibrasi Arah Kiblat dalam Penyempurnaan Ibadah Salat,” Al-Manahij J. Kaji. Huk. Islam, vol. 11, no. 1, pp. 113–132, 2018, doi: 10.24090/mnh.v11i1.1273.
A. Kiblat, B. Orang, Y. Jauh, and D. Ka, “Pandangan Tokoh Agama Jungka Gajah Terhadap,” vol. 1, no. 2, pp. 169–186, 2022.
S. T. Qulub and A. Munif, “Peran Teknologi Digital dalam Mengembangkan Ilmu Falak dalam Peradaban Islam,” ICONTIES (International Conf. Islam. Civiliz. Humanit., pp. 557–565, 2023.
H. Singgih, “Rancang-Bangun Alat Penunjuk Arah Kiblat Berbasis Gps,” pp. 79–92.
S. Ekawati, “Pengaruh geometri satelit dan ionosfer dalam kesalahan penentuan posisi gps,” Ber. Dirgant., vol. 11, no. Juni, pp. 59–65, 2010.
G. Ferio, R. Intan, and S. Rostianingsih, “Sistem Rekomendasi Mata Kuliah Pilihan Menggunakan Metode User Based Collaborative Filtering Berbasis Algoritma Adjusted Cosine Similarity,” J. Infra, vol. 7, no. 1, pp. 1–7, 2019.
Asif Raihan, “A Comprehensive Review of the Recent Advancement in Integrating Deep Learning with Geographic Information Systems,” Res. Briefs Inf. Commun. Technol. Evol., vol. 9, no. October, pp. 98–115, 2023, doi: 10.56801/rebicte.v9i.160.
A. Adil, R. A. Dwiputri, and B. K. Triwijoyo, “Aplikasi Spasial Rekomendasi Wisata Terdekat dengan Metode Haversine Berbasis Mobile,” J. Bumigora Inf. Technol., vol. 4, no. 1, pp. 95–106, 2022, doi: 10.30812/bite.v4i1.1948.
Y. Efenie and M. Walid, “Implementasi Metode K-Nearest Neighbour (K_Nn) Untuk Menduga Salinitas Air Laut,” J. Apl. Teknol. Inf. dan Manaj., vol. 1, no. 1, pp. 27–32, 2020, doi: 10.31102/jatim.v1i1.755.
A. Muliawan, T. Badriyah, and I. Syarif, “Membangun Sistem Rekomendasi Hotel dengan Content Based Filtering Menggunakan K-Nearest Neighbor dan Haversine Formula,” Technomedia J., vol. 7, no. 2, pp. 231–247, 2022, doi: 10.33050/tmj.v7i2.1893.
Majelis Tarjih dan Tajdid, Pedoman Hisab Muhammadiyah. 2009.
“Compare-Contrast-Connect: Converting Decimal Degrees to Degrees, Minutes, and Seconds.”https://manoa.hawaii.edu/exploringourfluidearth/physical/world-
ocean/locating-points-globe/compare-contrast-connect-converting-decimal- degrees?
T. Equator, “Latitude and Longitude,” pp. 1–7, [Online]. Available: https://www.tamiu.edu/cees/courses/epsc1170_labs/Lab01_LatLong.pdf?
“Azimuth,” [Online]. Available: https://www.merriam- webster.com/dictionary/azimuth.
“Azimuth,” [Online]. Available:
https://taylorandfrancis.com/knowledge/Engineering_and_technology/Engineer ing_support_and_special_topics/Azimuth/.
I. Hasjun, A. J. Kasim, and N. A. Putra, “Uji Akurasi Hasil Pengukuran Arah Kiblat Pegawai Kemasjidan Kua Menggunakan Aplikasi Google Earth,” Astroislamica J. Islam. Astron., vol. 3, no. 1, pp. 114–135, 2024, doi: 10.47766/astroislamica.v3i1.2796.
U. Brawijaya, R. Pardede, H. Farisi, and I. Arwani, “Fakultas Ilmu Komputer Pengembangan Sistem Aplikasi Monitoring Sepeda Motor Berbasis IoT dengan Modul GPS Guna Pemantauan dan Keamanan Kendaraan (Studi kasus: Roganda Rental Motorbike),” vol. 1, no. 1, pp. 2548–964, 2017, [Online]. Available: http://j- ptiik.ub.ac.id.
“Pusat Tarjih UAD.” https://pusattarjih.uad.ac.id.
T. Badriyah, R. Fernando, and I. Syarif, “Sistem Rekomendasi Content Based Filtering Menggunakan Algoritma Apriori,” Konf. Nas. Sist. Inf., vol. 1, no. 1, pp. 554–559, 2018.
Anderias Eko Wijaya and Deni Alfian, “Sistem Rekomendasi Laptop Menggunakan Collaborative Filtering Dan Content-Based Filtering,” J. Comput. Bisnis, vol. 12, no. 1, pp. 11–27, 2018.
J. L. Strunk, P. J. Gould, P. Packalen, K. P. Poudel, H. E. Andersen, and H. Temesgen, “An examination of diameter density prediction with k-NN and airborne lidar,” Forests, vol. 8, no. 11, pp. 1–16, 2017, doi: 10.3390/f8110444.
Z. Y. Lamasigi, “DCT Untuk Ekstraksi Fitur Berbasis GLCM Pada Identifikasi Batik Menggunakan K-NN,” Jambura J. Electr. Electron. Eng., vol. 3, no. 1, pp. 1–6, 2021, doi: 10.37905/jjeee.v3i1.7113.
A. Thariq and R. Nende, “Pengembangan Aplikasi Pencarian Tempat Kuliner Terdekat Di Kota Ambon Menggunakan Algoritma Greedy Berbasis Android Development of the Nearest Culinary Place Find Application in Ambon City Using Greedy Algorithm Based on Android,” IJIS Indones. J. Inf. Syst., vol. 9, no. April, pp. 35–46, 2024.
R. Haqiqi, A. Fourniawan, A. Eviyanti, and S. Busono, “Pengembangan Artificial Intelligence Berupa Virtual Assistant Mobile Menggunakan Framework Flutter,” J. TEKINKOM, vol. 7, no. 1, pp. 53–61, 2024, doi: 10.37600/tekinkom.v7i1.1169.
D. Febiharsa, I. M. Sudana, and N. Hudallah, “Uji Fungsionalitas (Blackbox Testing) Sistem Informasi Lembaga Sertifikasi Profesi (SILSP) Batik dengan AppPerfect Web Test dan Uji Pengguna,” Joined J. (Journal Informatics Educ., vol. 1, no. 2, p. 117, 2018, doi: 10.31331/joined.v1i2.752.
J. R. Lewis and J. Sauro, “Can I Leave This One Out? The Effect of Dropping an Item From the SUS,” J. Usability Stud., vol. 13, no. 1, pp. 38–46, 2017.
F. Purwani, R. T. Wahyudi, and I. D. Jaya, “Penerapan Algoritma K-Nearest Neighbor dengan Euclidean Distance untuk Menentukan Kelompok Uang Kuliah Tunggal Mahasiswa,” Edumatic J. Pendidik. Inform., vol. 6, no. 2, pp. 344–353, 2022, doi: 10.29408/edumatic.v6i2.6547.
Suhail, Faiq, and Ahmad Azhari. "EEG Classification for Brain Response Analysis through University Website Interface in Yogyakarta Using Naive Bayes and KNN." (2024).
Azhari, Ahmad, and Inosensia Lionetta Pricillia. "Klasifikasi K-Nearest Neighbor pada Penderita Insomnia berdasarkan Sinyal Elektroensefalogram." Sains, Aplikasi, Komputasi dan Teknologi Informasi 4.2 (2023): 51-58.
Yudhana, Anton, et al. "Human emotion recognition based on EEG signal using fast fourier transform and K-Nearest neighbor." Adv. Sci. Technol. Eng. Syst. J 5.6 (2020): 1082-1088.
Saputra, Dimas Chaerul Ekty, Ahmad Azhari, and Alfian Ma'arif. "K-Nearest Neighbor of Beta Signal Brainwave to Accelerate Detection of Concentration on Student Learning Outcomes." Engineering Letters 30.1 (2022).
A. Azhari and F. I. Ammatulloh, “Classification of Concentration Levels in Adult-Early Phase using Brainwave Signals by Applying K-Nearest Neighbor”, Sig.Img.Proc.Lett, vol. 1, no. 1, pp. 14–24, Mar. 2019.
Azhari, A., & Swara, A. K. S. (2020). Analysis the effects of games on cognitive activity of late adolescents using the electroencephalogram with the K-nearest neighbor method. Signal and Image Processing Letters, 2(1), 1-13.
Azhari, A., & Swara, A. K. S. (2019). K-Nearest Neighbor Classification for Detection of The Effect of Game Addiction on Cognitive Activity in The Late Adolescent Phase based on Brainwave Signals. Signal and Image Processing Letters, 1(2), 85-99.
Azhari, A., & Ramadan, R. (2019). Classification of concentration or focus by signal Electroencephalography (EEG) and addiction Watching K-Dramas Using Algoritma K-Nearest Neighbor. Signal and Image Processing Letters, 1(3), 32-42.

Downloads
Published
Issue
Section
License
Copyright (c) 2025 Girindra Sulistiyo Wardoyo, Ahmad Azhari

This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
Start from 2019 issues, authors who publish with JURNAL MOBILE AND FORENSICS agree to the following terms:
- Authors retain copyright and grant the journal right of first publication with the work simultaneously licensed under a Creative Commons Attribution License (CC BY-SA 4.0) that allows others to share the work with an acknowledgment of the work's authorship and initial publication in this journal.
- Authors are able to enter into separate, additional contractual arrangements for the non-exclusive distribution of the journal's published version of the work (e.g., post it to an institutional repository or publish it in a book), with an acknowledgment of its initial publication in this journal.
- Authors are permitted and encouraged to post their work online (e.g., in institutional repositories or on their website) prior to and during the submission process, as it can lead to productive exchanges, as well as earlier and greater citation of published work.
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.