BACKGROUND AND AIM: Generalized propensity score (GPS) is used to estimate causal effects of continuous treatments/exposures. The valid estimation relies on the assumption of no unmeasured confounding. Many environmental, demographic, built-environmental, behavioral, and health data can exhibit spatial patterns, raising concerns of unmeasured spatial confounding. Furthermore, researchers are often confronted with settings where continuous exposure is conditional on binary exposure status (e.g., level of a contaminant (continuous) within a specified radius from residence (binary)). Both binary and continuous exposures can commonly exhibit spatial patterns, such that unmeasured spatial confounding in both dimensions may be concerning. We developed a novel GPS matching method for such settings, called conditional GPS (CGPS)-based spatial matching (CGPSsm). METHODS: CGPSsm estimates the average treatment effect in the treated. CGPSsm matches exposed observational units (e.g., exposed participants) to unexposed units by their spatial proximity and GPS integrated with spatial information. GPS is estimated by separately estimating PS for the binary status (exposed vs. unexposed) and CGPS on the binary status. Spatial regression and machine learning can be leveraged to estimate GPS. A motivating example is to investigate the association between refineries with high petroleum production and refining (PPR) and stroke prevalence in the southeastern United States. RESULTS: CGPSsm maintains the salient benefits of propensity score matching and spatial analysis: straightforward assessments of covariate balance and adjustment for unmeasured spatial confounding. Statistical simulations showed that CGPSsm can adjust for unmeasured spatial confounding. Using our example, we found positive association between PPR and stroke prevalence. CONCLUSIONS: CGPSsm has potential in epidemiological studies where exposure has both binary and continuous attributes and unmeasured spatial confounding may be of concern (e.g., accessibility to emergency services, exposure to nearby environmental factors, and surrounding built environments). Our R package, CGPSspatialmatch, is publicly available. KEYWORDS: Causal inference; Generalized propensity score; Spatial confounding; Machine learning