You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since v8.0 and the updates to viewport, the solution to retrieve the north-west and south-east bounds of the map in this issue no longer works. From what I can see this is because the width and height are static, they now are always (-180, -85)
What would the new calculations now be to get the bounds of the map in the current viewport?
I have a reproducible jsfiddle here, and have copied the code below.
<html><head><!--<script src="https://unpkg.com/deck.gl@8.0.9/dist.min.js"></script> --><scriptsrc="https://unpkg.com/deck.gl@8.1.0-alpha.1/dist.min.js"></script><!-- only if base map is needed --><scriptsrc='https://api.tiles.mapbox.com/mapbox-gl-js/v1.2.0/mapbox-gl.js'></script><linkhref='https://api.tiles.mapbox.com/mapbox-gl-js/v1.2.0/mapbox-gl.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
#map { position:absolute; top:0; bottom:0; width:100%; }
</style></head><body><divid="map"><divid="viewState" class="mapViewStateContainer"></div></div></body><scripttype="text/javascript">// token from: https://docs.mapbox.com/mapbox-gl-js/example/simple-map/constdeckgl=newdeck.DeckGL({mapboxApiAccessToken: 'pk.eyJ1Ijoic3ltYm9saXgiLCJhIjoiY2prM2dqNWhiMTMwYzNrcnRmY2NnajI1cCJ9.g8-mLbubDPgqUv-CBx65Xg',container: 'map',initialViewState: {longitude: 144,latitude: -37,zoom: 6},controller: true,onViewStateChange: ({viewId, viewState})=>{varjsDiv=document.getElementById("viewState");varvs;constviewport=newdeck.WebMercatorViewport({viewState});constnw=viewport.unprojectFlat([0,0]);constse=viewport.unprojectFlat([viewport.width,viewport.height]);vs={nw: nw,se: se}jsDiv.innerHTML=JSON.stringify(vs);}})</script></html>
The text was updated successfully, but these errors were encountered:
Since v8.0 and the updates to viewport, the solution to retrieve the north-west and south-east bounds of the map in this issue no longer works. From what I can see this is because the width and height are static, they now are always (-180, -85)
What would the new calculations now be to get the bounds of the map in the current viewport?
I have a reproducible jsfiddle here, and have copied the code below.
The text was updated successfully, but these errors were encountered: