How to use the viewport-mercator-project.getWorldPosition function in viewport-mercator-project

To help you get started, we’ve selected a few viewport-mercator-project examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github uber / deck.gl / src / core / viewports / viewport.js View on Github external
this.distanceScales.pixelsPerMeter = new Vector3(this.distanceScales.pixelsPerMeter);

    this.position = ZERO_VECTOR;
    this.meterOffset = ZERO_VECTOR;
    if (position) {
      // Apply model matrix if supplied
      this.position = position;
      this.modelMatrix = modelMatrix;
      this.meterOffset = modelMatrix ? modelMatrix.transformVector(position) : position;
    }

    this.viewMatrixUncentered = viewMatrix;

    if (this.isGeospatial) {
      // Determine camera center
      this.center = getWorldPosition({
        longitude,
        latitude,
        scale: this.scale,
        distanceScales: this.distanceScales,
        meterOffset: this.meterOffset
      });

      // Make a centered version of the matrix for projection modes without an offset
      this.viewMatrix = new Matrix4()
        // Apply the uncentered view matrix
        .multiplyRight(this.viewMatrixUncentered)
        // The Mercator world coordinate system is upper left,
        // but GL expects lower left, so we flip it around the center after all transforms are done
        .scale([1, -1, 1])
        // And center it
        .translate(new Vector3(this.center || ZERO_VECTOR).negate());
github DefinitelyTyped / DefinitelyTyped / types / viewport-mercator-project / viewport-mercator-project-tests.ts View on Github external
});

const distanceScalesInputScale = {
    longitude: 1,
    latitude: 2,
    scale: 1,
};

const { metersPerPixel } = getDistanceScales(distanceScalesInputScale);

const { pixelsPerMeter2 } = getDistanceScales({
    ...distanceScalesInputScale,
    highPrecision: true,
});

const worldPos = getWorldPosition({
    longitude: 1,
    latitude: 2,
    zoom: 10,
    scale: 1,
});

const length = worldPos.length;