The following fact is trivial to see:
Let $X$ be a separable and locally compact metric space, then for each compact set $K\subset X$ there is a continuous function with compact support and such that $f|K=1$.
Indeed, $X=\bigcup \limits_{n=1}^{\infty} U_n$, where $\{U_n\}$ is a increasing sequence of open and precompact subset of $X$ (from the Lindelöf theorem). So there is an $m\in \mathbb{N}$, such that $K\subset U_m$. Now, applying Urysohn's theorem to the sets $K$ and $X \setminus U$, we find the suitable function (with support contained in $\operatorname{cl} U_m$, with is compact).
If something like that (or similar) would be true, when $X$ was a $\sigma$-compact Polish space?