It's a consequence of Lebesgue's theorem that every measurable $E\subset\mathbb{R}^n$ has a metric density that's $1$ a.e. on $E$ and $0$ a.e. on $\mathbb{R}^n\setminus E$. What are the most general conditions on the measure space for this property to hold?



Metric density theorem in most general setting?
It is true for doubling metric-measure spaces.
Check Theorem 1.8 in "Lectures on analysis on metric spaces" by Heinonen.


