Friday, June 10, 2022

Laravel / Google Maps -- Get Locations in Bounds

Problem: 

While working on a project using Laravel back-end and JavaScript front-end. I had a situation where I needed to get all the locations for the map with given bounds. First, I tried just doing a bounding box check, which worked but only sometimes. 


Solution:

In this problem, I was not alone. After reading and trying some various approaches, this one by FatMonk on SO did the trick. 

// Google Maps API map.getBounds()

$north = $lat1_ne || 90;
$east = $lng1_ne;
$south = $lat2_sw || -90;
$west = $lng2_sw;

$locations = Location::whereBetween('lat', [$south, $north])
    ->where(function($query) use ($west, $east){
        if ($west < $east){
            $query->whereBetween('lon', [$west, $east]);
        }else{
            $query->whereBetween('lon', [$west, 180])
                ->orWhereBetween('lon', [-180, $east]);
        }
})
->get();

Thursday, June 9, 2022

BlackMagic Ursa Mini G2 - Iso to gain dBs translation

Recently I have needed to get this information and couldn't quickly find it, so I'm shamelessly placing it here for next time :). 

db ISO
-12=100
-6=200
0=400
+6=800
+12=1600
+18=3200
+24=6400
+30=12800
+36=25600
Natives are 0db and +18db

ISO 100 = -12db. ISO doubles every 6db and the highest ISO is 25600 @ 36db.



Source: https://forum.blackmagicdesign.com/viewtopic.php?t=154758&p=822669