0

I have hexagonal tileset added as a layer to mapbox style though mapbox studio.

Trying to find possibility to reduce layer visible area. For example to show only 100m radius (or square with side equal to 100m) area around map center (current point marker).

Is this possible?

1 Answer 1

1

You can create a bounding box and use fitBounds method of the map, for example:

const boundingBox = [
   [minX,  minY],
   [maxX, maxY]
];

map.fitBounds(boundingBox);

More about fitBounds and other examples you can find here.

For creating bounding box you can use Turf.js library.

This code uses buffer and bbox methods to create bounding box with 100m side and given point in the center:

const pointBuffer = turf.buffer(point /* - your point GeoJSON */, 0.1, 'kilometers');
const boundingBox = turf.bbox(pointBuffer);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.