From b3b3dc41bce85850bf60347bdaec954390b674df Mon Sep 17 00:00:00 2001 From: Aaron Parecki Date: Sat, 4 Jun 2022 13:23:28 -0700 Subject: switch to local rendering of static map --- controllers/controllers.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'controllers') 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); + +}); + -- cgit v1.2.3