Context : The understanding of the formation process of massive stars ( \ga 8 M _ { \odot } ) is limited , due to a combination of theoretical complications and observational challenges . The high UV luminosities of massive stars give rise to chemical complexity in their natal molecular clouds , and affect the dynamical properties of their circumstellar envelopes . Aims : We investigate the physical structure of the large-scale ( \sim 10 ^ { 4 } – 10 ^ { 5 } AU ) molecular envelope of the high-mass protostar AFGL2591 . Methods : Observational constraints are provided by spectral imaging in the 330–373 GHz regime from the JCMT Spectral Legacy Survey and its high frequency extension . While the majority of the \sim 160 spectral features from the survey cube are spatially unresolved , this paper uses the 35 that are significantly extended in the spatial directions . For these features we present integrated intensity maps and velocity maps . The observed spatial distributions of a selection of six species are compared with radiative transfer models based on ( i ) a static spherically symmetric structure , ( ii ) a dynamic spherical structure , and ( iii ) a static flattened structure . Results : The maps of CO and its isotopic variations exhibit elongated geometries on scales of \sim 100 ″ , and smaller scale substructure is found in maps of N _ { 2 } H ^ { + } , o-H _ { 2 } CO , CS , SO _ { 2 } , C _ { 2 } H , and various CH _ { 3 } OH lines . In addition , a line of sight velocity gradient is apparent in maps of all molecular lines presented here , except SO , SO _ { 2 } , and H _ { 2 } CO. We find two emission peaks in warm ( E _ { \mathrm { up } } \sim 200 K ) CH _ { 3 } OH separated by 12″ ( 12 000 AU ) , indicative of a secondary heating source in the envelope . The spherical models are able to explain the distribution of emission for the optically thin H ^ { 13 } CO ^ { + } and C ^ { 34 } S , but not for the optically thick HCN , HCO ^ { + } , and CS , nor for the optically thin C ^ { 17 } O . 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 . Conclusions : Based on radiative transfer modeling , 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 circumstellar envelope models with an outflow cavity and/or inhomogeneous structure at scales \lesssim 10 ^ { 4 } AU . The picture of inhomogeneity is supported by observed substructure in at least six different species .