Map GL: Get points from the edges of the map to draw a polygon of geojson data to be sent to an api

Viewed 13

I'm rendering a react mapbox GL Map enter image description here

Please dont mind the polygons and the text in the side. What I'm trying to achieve is to get the points from my map to draw a rectangular like polygon, and use it as to get data from the api we are using.

I'm using mapbox GL. But I can't seem to find the correct way to do it.

I've tried using getbounds but it would only return the southwest and northeast lat longs.

I want to get the lat long of southeast and northeast edges of the existing map on the screen.

I want it in a way that when I move the map the edges also change.

0 Answers
Related