How to use the @mapbox/geo-viewport.bounds function in @mapbox/geo-viewport

To help you get started, we’ve selected a few @mapbox/geo-viewport 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 keplergl / kepler.gl / src / deckgl-layers / cluster-layer / cluster-layer.js View on Github external
getClusters() {
    const {geoJSON} = this.state;
    const {clusterRadius, mapState} = this.props;
    const {longitude, latitude, zoom, width, height} = mapState;
    // zoom needs to be an integer for the different map utils. Also helps with cache key.
    const zoomRound = Math.round(zoom);
    const bbox = geoViewport.bounds([longitude, latitude], zoomRound, [
      width,
      height
    ]);

    const clusters = clustersAtZoom({bbox, clusterRadius, geoJSON, zoom: zoomRound});

    this.setState({clusters});
  }
github DefinitelyTyped / DefinitelyTyped / types / mapbox__geo-viewport / mapbox__geo-viewport-tests.ts View on Github external
import { viewport, bounds } from '@mapbox/geo-viewport';

const geoViewport = viewport([
    5.668343999999995,
    45.111511000000014,
    5.852471999999996,
    45.26800200000002,
], [640, 480]);

const boundingBox = bounds({
    lon: 100,
    lat: 200,
}, 14, [640, 480]);

const boundingBox2 = bounds([100, 200], 14, [640, 480]);
github DefinitelyTyped / DefinitelyTyped / types / mapbox__geo-viewport / mapbox__geo-viewport-tests.ts View on Github external
import { viewport, bounds } from '@mapbox/geo-viewport';

const geoViewport = viewport([
    5.668343999999995,
    45.111511000000014,
    5.852471999999996,
    45.26800200000002,
], [640, 480]);

const boundingBox = bounds({
    lon: 100,
    lat: 200,
}, 14, [640, 480]);

const boundingBox2 = bounds([100, 200], 14, [640, 480]);

@mapbox/geo-viewport

convert between viewports and extents

BSD-2-Clause
Latest version published 3 years ago

Package Health Score

57 / 100
Full package analysis

Popular @mapbox/geo-viewport functions