Comments (2)
[ActionTypes.UPDATE_MAP]: (state, action) => {
let vp = action.payload.payload.viewport
// vp = {
// "width": 1602,
// "height": 626,
// "latitude": 10.584484326657442,
// "longitude": -21.614888755810878,
// "zoom": 1.3013429703944752,
// "bearing": 0,
// "pitch": 0,
// "altitude": 1.5,
// "maxZoom": 20,
// "minZoom": 0,
// "maxPitch": 60,
// "minPitch": 0,
// "normalize": true,
// "position": [
// 0,
// 0,
// 0
// ],
// "transitionDuration": 0
// }
console.log("UPDATE_MAP")
let zoomVal = vp.hasOwnProperty("zoom") ? vp.zoom : 1
let latitude = vp.hasOwnProperty("latitude") ? vp.latitude : 0
let longitude = vp.hasOwnProperty("longitude") ? vp.longitude : 0
if (latitude === 37.75043 && longitude === -122.34679 && zoomVal === 9){
console.log("error position")
} else if (vp.hasOwnProperty("zoom")) {
// let mapState = {
// bearing: vp.hasOwnProperty("bearing") ? vp.bearing : 0,
// dragRotate: false,
// latitude: vp.hasOwnProperty("latitude") ? vp.latitude : 0,
// longitude: vp.hasOwnProperty("longitude") ? vp.longitude : 0,
// pitch: vp.hasOwnProperty("pitch") ? vp.pitch : 0,
// zoom: vp.hasOwnProperty("zoom") ? vp.zoom : 1,
// isSplit: false,
// }
let mapState = vp
sampleCustomConfig.config.mapState = mapState
const message = {
message: {
source: "react",
type: "UPDATE_MAP",
mapState: mapState
}
};
try {
window.parent.postMessage(message, '*');
}catch (e) {
console.log(e)
}
}
// return {...state, viewport: action.payload}
return {...state}
},
I find it works, but another question has happen, how can I keep the viewport when I reload new data? I want to change h3 layer resolution, when I zoom in, I will increase the h3 resolution, when I zoom out, I will decrease the resolution, now when I zoom in , the viewport cannot be locked, it always reset to the initial viewport
from kepler.gl.
The question is how to set viewport when addDataToMap? thanks so much
from kepler.gl.
Related Issues (20)
- Why is the mapbox missing after the 3.0.0 update? HOT 1
- [Bug]Add Custom Map Style seems not work HOT 2
- onClick not work HOT 1
- how to use onMapClick HOT 1
- [Bug] GeoArrow reading latitude as zero HOT 6
- Satellite imagery disappeared HOT 4
- [Bug] The layer has been disabled and highlighted HOT 3
- [Bug] incorrect coordinates
- Ability to use custom aggregate functions and custom tooltip for Hexbin(layer type: hexagon) HOT 1
- Custom Icon
- Custom colorRange with specify value (layer hexbin)
- Babel did not compile the TypeScript files in the 'src' directory
- [Bug]
- [Bug]: Cannot add a custom mapStyle HOT 3
- [Bug] Time slider for trips layer is broken HOT 1
- [Bug] Trips Layer not displaying animated data nor time slider HOT 1
- Tooltip not Working When Exporting Map HTML [Bug] HOT 4
- [Bug] module.exports = require('./dist/reducers') HOT 2
- Custom Map Style not working HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kepler.gl.