<?php 
require 'vendor/autoload.php';
use Grimzy\LaravelMysqlSpatial\Types\Point;
use Grimzy\LaravelMysqlSpatial\Types\Polygon;
use Grimzy\LaravelMysqlSpatial\Types\LineString;
require 'inc/Config.php';

header('Content-Type: application/json; charset=utf-8');
$id = $_GET['id'];
$coordinates = $lundry->query("SELECT ST_AsGeoJSON(`coordinates`)  FROM `zones` WHERE id=".$id."")->fetch_array();
$data = json_decode($coordinates[0]);
$rows = $data->coordinates[0];
$data = array();
$js = array();
foreach ($rows as $row) {
	$data['lat'] = $row[1];
$data['lng'] = $row[0];
$js[] = $data;
}

echo json_encode($js);
?>


