People with access to green spaces are more likely to be more environmentally friendly, study says.