Infection with liver flukes (Opisthorchis viverrini) is partly due to their ability to thrive in habitats in sub-basin areas, causing the intermediate host to remain in the watershed system throughout the year. Spatial modeling is used to predict water source infections, which involves designing appropriate area units with hexagonal grids. This allows for the creation of a set of independent variables, which are then covered using machine learning techniques such as forest-based classification regression methods. The independent variable set was obtained from the local public health agency and used to establish a relationship with a mathematical model. The ordinary least (OLS) model approach was used to screen the variables, and the most consistent set was selected to create a new set of variables using the principal of component analysis (PCA) method. The results showed that the forest classification and regression (FCR) model was able to accurately predict the infection rates, with the PCA factor yielding a reliability value of 0.915. This was followed by values of 0.794, 0.741, and 0.632, respectively. This article provides detailed information on the factors related to water body infection, including the length and density of water flow lines in hexagonal form, and traces the depth of each process.