As cities become bigger and denser, green spaces are boosting their resilience and making them more attractive places to live.