Skip to content

Commit

Permalink
ArcGIS 3D altitude fix (#5066)
Browse files Browse the repository at this point in the history
  • Loading branch information
damix911 committed Oct 26, 2020
1 parent 76085c7 commit e1e102f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions modules/arcgis/src/deck-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

import {initializeResources, render, finalizeResources} from './commons';

// ArcGIS fov is corner-to-corner
function arcgisFOVToDeckAltitude(fov, aspectRatio) {
const D = Math.sqrt(1 + aspectRatio ** 2);
const halfFOV = (fov / 2 / 180) * Math.PI;
return D / 2 / Math.tan(halfFOV);
}

export default function createDeckRenderer(DeckProps, externalRenderers) {
class DeckRenderer {
constructor(view, props) {
Expand Down Expand Up @@ -36,6 +43,7 @@ export default function createDeckRenderer(DeckProps, externalRenderers) {
viewState: {
latitude: this.view.center.latitude,
longitude: this.view.center.longitude,
altitude: arcgisFOVToDeckAltitude(this.view.camera.fov, width / height),
zoom: this.view.zoom,
bearing: this.view.camera.heading,
pitch: this.view.camera.tilt
Expand Down

0 comments on commit e1e102f

Please sign in to comment.