A light ranging and detection system achieving reconfigurable very wide field of view, high sampling of spatial points per second with high optical power handling by using architecture to efficiently combine different wavelengths, time and frequency coding, and spatial selectivity. The transmitter is capable of generating multiple narrow beams, encoding different beams and transmitting in different spatial directions. The receiver can differentiate and extract range and reflectivity information of reflected beams. Three dimensional imaging of the environment is achieved by scanning the field of view of the transmitter. Control and signal processing electronic circuitries fabricated in a chip are packaged together with a chip containing the photonic components of the ranging system. The light ranging and detection system generates a THz beam in addition to an optical beam, and both beams combined allow reconfigurable spectroscopy.