I have an image file that I am able to overlay perfectly fine onto my Leaflet map with this code:
var initLat = 38.9761;
var initLon = -77.4875;
var imageUrl = '/weather/nexrad/radar.png';
var imageBounds = [[initLat + 3, initLon + 3], [initLat - 3, initLon - 3]];
L.imageOverlay(imageUrl, imageBounds).addTo(map);
But as you can see, I have been trying to simulate a center point for that image overlay by just adding and subtracting 3
from my desired center point (initLat
and initLon
).
How can I create a Leaflet ImageOverlay using not two corner points, but a center point (in this case 38.9761, -77.4875
), and having a zoom value as well to determine the size of that image overlay?
I am perfectly fine with using a bit of math to achieve this, but I haven't been able to figure out how I would use math in this scenario.
<BoundingBox CRS="CRS:84" minx="-111.824" miny="30.1492" maxx="-101.8232" maxy="40.15"/>
. Note that the Meractor projection doesn't map the same number of pixels per latitude degree, but for small changes in latitude, you can probably get away with assuming otherwise