The current practice of users searching for different types of geo-resources in a geographic area and wishing to identify the most convenient routes for visiting the most relevant ones, requires the iterative formulation of several queries: first to identify the more interesting resources and then to select the best route to visit them. In order to simplify this process, in this paper a novel functionality for a geographic information retrieval (GIR) system is proposed, which retrieves and ranks several routes for visiting a number of relevant georeferenced resources as a result of a single query, named flexible trip-planning query. An original retrieval model is defined to identify the relevant resources and to rank the most convenient routes by taking into account personal user preferences. To this end, a graph-based algorithm is defined, exploiting prioritized aggregation to optimize the routes’ identification and ranking. The proposed algorithm is applied in the proof-of-concept of a Smart cOmmunity-based Geographic infoRmation rEtrievAl SysTem (SO-GREAT) designed to strengthen local communities: it collects and manages open data from regional authorities describing categories of authoritative territorial resources and services, such as schools, hospitals, etc., and from volunteered geographic services (VGSs) created by citizens to offer services in their neighbourhood.