Get all terms/slugs – used, not used & in hierarchical order

Try this.

$locations = get_terms( 'location', 'hide_empty=0&orderby=term_group' );

The codex says to avoid using term_group but it should be fine. It was never fully implementet but, according to others, its used quite often.