diff options
author | Aaron Parecki <aaron@parecki.com> | 2022-06-04 13:23:28 -0700 |
---|---|---|
committer | Aaron Parecki <aaron@parecki.com> | 2022-06-04 13:23:28 -0700 |
commit | b3b3dc41bce85850bf60347bdaec954390b674df (patch) | |
tree | b0ba566467ece4ccb087f99e545e4799c816a079 /controllers | |
parent | 30f62de1816439ba5920abfbede0721d568b8962 (diff) |
switch to local rendering of static map
Diffstat (limited to 'controllers')
-rw-r--r-- | controllers/controllers.php | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/controllers/controllers.php b/controllers/controllers.php index 0917315..82dfaca 100644 --- a/controllers/controllers.php +++ b/controllers/controllers.php @@ -898,3 +898,27 @@ $app->get('/airport-info', function() use($app){ $app->response()->body(json_encode($response)); } }); + +$app->get('/map-img', function() use($app) { + + $params = $app->request()->params(); + + $app->response()['Content-type'] = 'image/png'; + + $params = [ + 'marker[]' => 'lat:'.$params['lat'].';lng:'.$params['lng'].';icon:small-blue-cutout', + 'basemap' => 'custom', + 'width' => $params['w'], + 'height' => $params['h'], + 'zoom' => $params['z'], + 'tileurl' => Config::$mapTileURL, + 'token' => Config::$atlasToken, + ]; + + $ch = curl_init('https://atlas.p3k.io/map/img'); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, false); + curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params)); + curl_exec($ch); + +}); + |