We investigate how dust temperature is affected by local environmental quantities, especially dust surface density (Σdust), dust-to-gas ratio (D/G), and interstellar radiation field. We compile multiwavelength observations in 46 nearby galaxies, uniformly processed with a common physical resolution of 2 kpc. A physical dust model is used to fit the infrared dust emission spectral energy distribution (SED) observed with WISE and Herschel. The star formation rate (SFR) is traced with GALEX ultraviolet data corrected by WISE infrared. We find that the dust temperature correlates well with the SFR surface density (ΣSFR), which traces the radiation from young stars. The dust temperature decreases with increasing D/G at fixed ΣSFR, as expected from stronger dust shielding at high D/G, when ΣSFR is higher than $\sim 2\times 10^{-3}~\rm M_\odot ~yr^{-1}~kpc^{-2}$. These measurements are in good agreement with the dust temperature predicted by our proposed analytical model. Below this range of ΣSFR, the observed dust temperature is higher than the model prediction and is only weakly dependent on D/G, possibly due to dust heating from an old stellar population or the variation of SFR within the past 1010 yr. Overall, the dust temperature as a function of ΣSFR and Σdust predicted by our analytical model is consistent with observations. We also notice that, at fixed gas surface density, ΣSFR tends to increase with D/G, i.e. we can modify the Kennicutt–Schmidt law empirically with a dependence on D/G to match observations better.