2020-06-12 21:54:05 +02:00
|
|
|
<?php
|
|
|
|
|
2023-04-07 20:01:54 +02:00
|
|
|
use SokoWeb\Database\Query\Modify;
|
|
|
|
use SokoWeb\Database\Query\Select;
|
|
|
|
use SokoWeb\Interfaces\Database\IResultSet;
|
2020-06-12 21:54:05 +02:00
|
|
|
use MapGuesser\Util\Geo\Bounds;
|
|
|
|
|
|
|
|
$select = new Select(\Container::$dbConnection, 'maps');
|
|
|
|
$select->columns(['id', 'bound_south_lat', 'bound_west_lng', 'bound_north_lat', 'bound_east_lng']);
|
|
|
|
|
|
|
|
$result = $select->execute();
|
|
|
|
|
|
|
|
while ($map = $result->fetch(IResultSet::FETCH_ASSOC)) {
|
|
|
|
$bounds = Bounds::createDirectly($map['bound_south_lat'], $map['bound_west_lng'], $map['bound_north_lat'], $map['bound_east_lng']);
|
|
|
|
|
|
|
|
$modify = new Modify(\Container::$dbConnection, 'maps');
|
|
|
|
$modify->setId($map['id']);
|
|
|
|
$modify->set('area', $bounds->calculateApproximateArea());
|
|
|
|
$modify->save();
|
|
|
|
}
|