Friday, June 10, 2022

Laravel / Google Maps -- Get Locations in Bounds


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. 


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]);
            $query->whereBetween('lon', [$west, 180])
                ->orWhereBetween('lon', [-180, $east]);

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
Natives are 0db and +18db

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