select('terrain', 'type', ["AND" => ["latitude" => $lat, "longitude" => $long]])[0]; $out = ["status" => "OK", "type" => $terrainid]; echo json_encode($out);