Set base map theme to Light without switching

This is necessary until we transition to a better
option for base maps (e.g. vector maps), as the
previous OS API is now defunct / inaccessible
This commit is contained in:
Maciej Ziarkowski 2021-05-06 18:53:57 +01:00
parent 1ee6a7581e
commit b0791c4cdc
2 changed files with 8 additions and 8 deletions

View File

@ -3,7 +3,7 @@ import { TileLayer } from 'react-leaflet';
import { MapTheme } from '../../config/map-config'; import { MapTheme } from '../../config/map-config';
const OS_API_KEY = 'NVUxtY5r8eA6eIfwrPTAGKrAAsoeI9E9'; const OS_API_KEY = 'UVWEspgInusDKKYANE5bmyddoEmCSD4r';
/** /**
* Base raster layer for the map. * Base raster layer for the map.
@ -15,10 +15,10 @@ export function CityBaseMapLayer({theme}: {theme: MapTheme}) {
* Ordnance Survey maps - UK / London specific * Ordnance Survey maps - UK / London specific
* (replace with appropriate base map for other cities/countries) * (replace with appropriate base map for other cities/countries)
*/ */
const key = OS_API_KEY; const apiKey = OS_API_KEY;
const tilematrixSet = 'EPSG:3857'; const layer = theme === 'light' ? 'Light_3857' : 'Night 3857';
const layer = theme === 'light' ? 'Light 3857' : 'Night 3857';
const baseUrl = `https://api2.ordnancesurvey.co.uk/mapping_api/v1/service/zxy/${tilematrixSet}/${layer}/{z}/{x}/{y}.png?key=${key}`; const baseUrl = `https://api.os.uk/maps/raster/v1/zxy/${layer}/{z}/{x}/{y}.png?key=${apiKey}`;
const attribution = 'Building attribute data is © Colouring London contributors. Maps contain OS data © Crown copyright: OS Maps baselayers and building outlines. <a href=/ordnance-survey-licence.html>OS licence</a>'; const attribution = 'Building attribute data is © Colouring London contributors. Maps contain OS data © Crown copyright: OS Maps baselayers and building outlines. <a href=/ordnance-survey-licence.html>OS licence</a>';
return <TileLayer return <TileLayer

View File

@ -44,7 +44,7 @@ class ColouringMap extends Component<ColouringMapProps, ColouringMapState> {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
theme: 'night', theme: 'light',
...defaultMapPosition ...defaultMapPosition
}; };
this.handleClick = this.handleClick.bind(this); this.handleClick = this.handleClick.bind(this);
@ -104,7 +104,7 @@ class ColouringMap extends Component<ColouringMapProps, ColouringMapState> {
name={'cc-base-pane'} name={'cc-base-pane'}
style={{zIndex: 50}} style={{zIndex: 50}}
> >
{/* <CityBaseMapLayer theme={this.state.theme} /> */} {/* temporarily disable the base map due to OS account issues */} <CityBaseMapLayer theme={this.state.theme} />
<BuildingBaseLayer theme={this.state.theme} /> <BuildingBaseLayer theme={this.state.theme} />
</Pane> </Pane>
@ -144,7 +144,7 @@ class ColouringMap extends Component<ColouringMapProps, ColouringMapState> {
</div> </div>
} }
<Legend legendConfig={categoryMapDefinition?.legend} /> <Legend legendConfig={categoryMapDefinition?.legend} />
<ThemeSwitcher onSubmit={this.themeSwitch} currentTheme={this.state.theme} /> {/* <ThemeSwitcher onSubmit={this.themeSwitch} currentTheme={this.state.theme} /> */}
<SearchBox onLocate={this.handleLocate} /> <SearchBox onLocate={this.handleLocate} />
</Fragment> </Fragment>
} }