Re: apartment/townhouses
I don't know what you are really looking for.
If there is a common area to all (common basement to all and accessible to all) then the panels can all be located together. (if you have a common area, now you either need a public panel, or redundant lighting systems for public areas from each unit being serviced by that common area)
If there is no common area, each panel must be in its respective unit.
The meters can be ganged together. Generally they are outside and in an accessible area.
As to seperate buildings, george is correct.