The understanding of the formation process of massive stars (>8 Msun) is limited, due to theoretical complications and observational challenges. We investigate the physical structure of the large-scale (~10^4-10^5 AU) molecular envelope of the high-mass protostar AFGL2591 using spectral imaging in the 330-373 GHz regime from the JCMT Spectral Legacy Survey. Out of ~160 spectral features, this paper uses the 35 that are spatially resolved. The observed spatial distributions of a selection of six species are compared with radiative transfer models based on a static spherically symmetric structure, a dynamic spherical structure, and a static flattened structure. The maps of CO and its isotopic variations exhibit elongated geometries on scales of ~100, and smaller scale substructure is found in maps of N2H+, o-H2CO, CS, SO2, CCH, and methanol lines. A velocity gradient is apparent in maps of all molecular lines presented here, except SO, SO2, and H2CO. We find two emission peaks in warm (Eup~200K) methanol separated by 12, indicative of a secondary heating source in the envelope. The spherical models are able to explain the distribution of emission for the optically thin H13CO+ and C34S, but not for the optically thick HCN, HCO+, and CS, nor for the optically thin C17O. The introduction of velocity structure mitigates the optical depth effects, but does not fully explain the observations, especially in the spectral dimension. A static flattened envelope viewed at a small inclination angle does slightly better. We conclude that a geometry of the envelope other than an isotropic static sphere is needed to circumvent line optical depth effects. We propose that this could be achieved in envelope models with an outflow cavity and/or inhomogeneous structure at scales smaller than ~10^4 AU. The picture of inhomogeneity is supported by observed substructure in at least six species.