Last active
January 5, 2020 12:35
-
-
Save ingenieroariel/33ee03e239b4fbdf09a9903fe7d5109d to your computer and use it in GitHub Desktop.
Custom Kepler.gl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"/> | |
<title>Kepler.gl embedded map</title> | |
<script src="./[email protected]/dist/react.min.js" crossorigin></script> | |
<script src="./[email protected]/dist/react-dom.min.js" crossorigin></script> | |
<script src="./[email protected]/dist/redux.js" crossorigin></script> | |
<script src="./[email protected]/dist/react-redux.min.js" crossorigin></script> | |
<script src="./[email protected]/umd/keplergl.min.js"></script> | |
<script> | |
const MAPBOX_TOKEN = '<private>'; | |
</script> | |
</head> | |
<body> | |
<div id="app"> | |
</div> | |
<script> | |
const map = (function initKeplerGl(react, reactDOM, redux, reactRedux, keplerGl, mapboxToken) { | |
const reducers = redux.combineReducers({ | |
keplerGl: keplerGl.keplerGlReducer | |
}); | |
const middlewares = keplerGl.enhanceReduxMiddleware([ | |
]); | |
const enhancers = redux.applyMiddleware(...middlewares); | |
const initialState = {}; | |
const store = redux.createStore( | |
reducers, | |
initialState, | |
redux.compose(enhancers) | |
); | |
function App(props) { | |
return react.createElement( | |
'div', | |
{style: {position: 'absolute', left: 0, width: '100vw', height: '100vh'}}, | |
react.createElement( | |
keplerGl.KeplerGl, | |
{ | |
mapboxApiAccessToken: mapboxToken, | |
id: 'map', | |
width: props.width || 1400, | |
height: props.height || 800 | |
} | |
) | |
) | |
} | |
return { | |
render: () => { | |
reactDOM.render(react.createElement( | |
reactRedux.Provider, | |
{store}, | |
react.createElement(App, null) | |
), document.getElementById('app')); | |
}, | |
store | |
}; | |
}(React, ReactDOM, Redux, ReactRedux, KeplerGl, MAPBOX_TOKEN)); | |
map.render(); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment