In this work we propose a novel methodology in order to automatically optimize the location of the sampling points for a water quality monitoring network in an estuary, in such a way that any unknown pollution source can be identified (both in intensity and location) from the data supplied by those sampling points. In the central part of the article, after a rigorous mathematical formulation of the environmental problem, the full details of its numerical implementation are given. Finally, we present and analyze the results when applying above proposed technique to study a real case in Ria of Vigo (northwestern Spain).