Calculate users location with bounding box with current location

I have Geolocator package that I am using to gain users current location. This is returned in lat,long format.

I am now calling an API and the bounding box is a parameter in the URL. I want to take a certain area around their current location, making users location the centre point of the bounding box.

Bounding Box needs min (Longitude, latitude ) & max(longitude, latitude).

I don't know how to calculate that and can't find much online to help out.


Solution 1:

You can subtract the desired width & height from the current position to get the min and then add the same width & height to get the max. That should get you your bounding box.

Bounded box around position