Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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});
}
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]);
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]);