We consider a generalization of the median and center facility location problem called the collection depots facility location (CDFL) problem. We are given a set of client locations and a set of collection depots and we are required to find the placement for a certain number of facilities, so that the cost of dispatching a vehicle from a facility, to a client, to a collection depot, and back, is optimized for all clients. The CDFL center problem minimizes the cost of the most expensive vehicle tour among all clients, and the CDFL median problem minimizes the sum of the tour costs for all clients. We provide the first polynomial time algorithms to solve the 1 and k median problems in trees with time complexities O(n log n) and O(kn 3 ), respectively, where n is the number of vertices in the tree. In contrast, a restricted version of the k -median problem, where clients are given lists of allowed collection depots, is NP-complete even for star graphs. We also give an optimal linear time algorithm to solve the discrete and continuous weighted 1-center problem, improving on the O(n log n) result of Tamir and Halman [Discrete Optimization 2(2005), 168-184].