Skip to content

Commit

Permalink
remove mapbox baseMap
Browse files Browse the repository at this point in the history
  • Loading branch information
Xintong Xia committed Mar 21, 2019
1 parent 668a40c commit fdcf7b5
Showing 1 changed file with 7 additions and 17 deletions.
24 changes: 7 additions & 17 deletions examples/website/openstreet-map/app.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import React, {Component} from 'react';
import {render} from 'react-dom';

import {StaticMap} from 'react-map-gl';
import DeckGL, {TileLayer, BitmapLayer} from 'deck.gl';
import {loadImage} from '@loaders.gl/core';

// Set your mapbox token here
const MAPBOX_TOKEN = process.env.MapboxAccessToken; // eslint-disable-line

export const INITIAL_VIEW_STATE = {
latitude: 47.65,
longitude: 7,
Expand Down Expand Up @@ -37,6 +33,7 @@ function tileIndexToBounds({x, y, z}) {
export class App extends Component {
constructor(props) {
super(props);
this.state = {};
this._getTileData = this._getTileData.bind(this);
}

Expand All @@ -55,15 +52,17 @@ export class App extends Component {
});
});

return new BitmapLayer({id: layerId, ...this.state[layerId]});
return new BitmapLayer({
id: layerId,
...this.state[layerId]
});
}
})
];
}

_getTileData({x, y, z}) {
const [west, south, east, north] = tileIndexToBounds({x, y, z});
// const mapSource = `https://a.tiles.mapbox.com/v4/mapbox.mapbox-streets-v7/${z}/${x}/${y}.vector.pbf?access_token=${MAPBOX_TOKEN}`;
const mapSource = `https://${s}.tile.openstreetmap.org/${z}/${x}/${y}.png`;
return loadImage(mapSource).then(data => {
return {
Expand All @@ -74,24 +73,15 @@ export class App extends Component {
}

render() {
const {viewState, controller = true, baseMap = true} = this.props;
const {viewState, controller = true} = this.props;

return (
<DeckGL
layers={this._renderLayers()}
initialViewState={INITIAL_VIEW_STATE}
viewState={viewState}
controller={controller}
>
{baseMap && (
<StaticMap
reuseMaps
mapStyle="mapbox://styles/mapbox/dark-v9"
preventStyleDiffing={true}
mapboxApiAccessToken={MAPBOX_TOKEN}
/>
)}
</DeckGL>
/>
);
}
}
Expand Down

0 comments on commit fdcf7b5

Please sign in to comment.