Measuring galaxy environment with the synergy of future photometric and spectroscopic surveys